Elements of Programming Interviews – 16.4 Generate Power Set – solution 1 time complexity question

hope you all are doing well.

I have a question about the time complexity of solution 1 for question 16.4 – Generate Power Set from the book Elements of Programming Interviews by Adnan and Tsung-Hsien.

The question instructs the reader to “Write a function that takes as input a set and returns its power set”. The input is the set S = {0,1,2}.

enter image description here

I understand that there are at most 2^n recursive calls of the method directedSoFar. However, I don’t understand why we spend O(n) time within a call of directedSoFar. There are no loops inside the method, only 2 lines at the recursive case to add and remove elements into the current selectedSoFar solution, and another 2 lines at the base case. Doesn’t this mean that we only spend constant time within a call, and not O(n) time?

I’ve struggled with this for a while, and have posted on the official forum as well as Reddit, but got no responses. I would appreciate it if anyone would be generous enough to help me.

Thank you

In my pc i installed Dual os Windows 10 with ubuntu 16.4 lts version

answers Why Windows 10 Splash screen not working with Ubuntu 16.04 I have installed dual OS(Windows 10 along with Ubuntu 16.04) in my system. Problem is when I boot system with Windows 10 OS, it display something like below image, not the splash screen or welcome message. NOTE: Same problem continues with Ubuntu 18.04 How can I resolve this …

its showing( purple(rose color)blank screen) windows is not booting…5 to 10 times we enter ker very force it will booting to windows.

installled both in BOOT option in LEGASY mode.. How to resolve this error..

Managing MySQL setting on Ubuntu Lunix 16.4 when automatic unattended upgrade happens

I just had MySQL 5.7.25 upgraded automatically in unattended mode and the settings I had set for ExecStart disappeared. How do I preserve the ExecStart setting so I am not blind side on the next automatic unattended upgrade. The ExecStart settings were in the file:


MySQL systemd service file

[Unit] Description=MySQL Community Server After=network.target

[Install] WantedBy=multi-user.target

[Service] User=mysql Group=mysql PermissionsStartOnly=true ExecStartPre=/usr/share/mysql/mysql-systemd-start pre

Normally, we’d simply use:


ExecStart=/usr/sbin/mysqld –sql-mode=ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION ExecStartPost=/usr/share/mysql/mysql-systemd-start post TimeoutSec=600 Restart=on-failure RuntimeDirectory=mysqld RuntimeDirectoryMode=755

Deactivate weather server (aviationweather.gov) Mate 16.4

Since I’ve set a location in Ubuntu Mate, it’s getting weather forecasts every few seconds. How can I disable it? I’ve already removed the location again, but Ubuntu still keeps getting information from aviationweather.gov. Would be glad for any tip for disabling it, because it’s waking up my device all the time.

Cannot print from LTS 16.4 to newly installed Brother MFC-L2700DW network or USB

I installed an existing MFC-L2700DW printer on my Ubuntu. I used deb package at https://support.brother.com/g/b/downloadlist.aspx?c=eu_ot&lang=en&prod=mfcl2700dw_us_eu_as&os=128 I connected the printer via WPS and see it in router control panel. Installation finished, however I did get this error:

lpinfo: cups-deviced failed to execute. lpadmin -p MFCL2700DW -E -v usb://dev/usb/lp0 -P /usr/share/cups/model/brother-MFCL2700DW-cups-en.ppd lpadmin: Bad device-uri scheme "usb". 

But the installation continues. After it completes and I look at printer properties, I see location = ~empty~ device uri = file:///dev/null make and model = Local Raw Printer.

I can send something to the printer with Libre Office, but nothing ever prints.

I have tried over my network and with the USB connection.