asked    Jeff     2018-10-22       python       57 view        1 Answer

[SOLVED] Time Complexity of while loop

What is the Best case, Worst Case and Average Case scenario of the following code segment ? def sumInts(n): Count = 0 while i < n: Count = count + n Return count

  1 Answer  

        answered    Agnes     2018-10-22      

It doesn't run because there's neither an i nor a count defined anywhere.

In other words: Best case: crash, Worst case: crash, Average case: crash.





Your Answer





 2018-10-22         Dawn

How do I close the download pop in chrome browser when downloading PDF

I am using java selenium to automate my application.I am downloading PDF and parsing.There are multiple test cases with PDF in my application. So once i download first PDF the chrome show a pop at the bottom of browser that file is downloaded with file name so next time when i try to download the second PDF the Download button is below this pop and not able to click on download option.Used isDisplayed method to check status which return false and isEnabled returns true.Tried execution of the PDF testcase in another window it is not working either. Please refer the image for...
 java                     2 answers                     32 view
 2018-10-22         Walter

Array of Bitmap from array in xml file

I have in my array.xml an array of more than 100 images with all different name.<array name="icons"> <item>@drawable/setting</item> <item>@drawable/simplemode</item>...I need to load all them inside an array of BitmapHow can I do? Thanks Resources arrays that contains references to Drawables are called TypedArray in Android. You can refer to them very easily. Here's an example:TypedArray icons = getResources().obtainTypedArray(R.array.icons);Not, icons can retrieve the drawables for you. You can find the reference here: https:/...
 android                     1 answers                     38 view
 2018-10-22         Leo

Post incrementing operator and array assignment

Here is the code below:public class Country{ private String name; private City [] cities; private int index =0; public Country (String n, int nrc){ // nrc as in number of cities name = n; cities = new City[nrc]; } public boolean exists (City str){ for(int i =0; i>index;i++){ if(cities[i].equals(str)){ return true; } } return false; } public void addCity (City str){ if(str == null){ System.out.print("City not initialized!"); } if(exists(str)){ ...
 java                     5 answers                     35 view