Computers and Technology
Computers and Technology, 01.07.2020 15:01, nyjaelynn

Suppose that you want to add an LLList constructor that takes a reference to an ArrayList as its only parameter and constructs an LLList object that represents the same list as the ArrayList - i. e., that has the same items in the same positions in the list. You have two versions to choose from, both of which are shown below. Algorithm A: lic LLList (ArrayList aList) { // initialize an empty list head = new Node (null, null); length = 0; // dummy hea // add the items from aList to this list for (int i = alist. length() - 1; i >= 0; i--) Object item = aList. getItem(i); addItem(item, 0);
Algorithm B: public LLList (ArrayList aList) { // initialize an empty list head = new Node (null, null); length = 0; // dummy // add the items from aList to this lis for (int i = 0; i < aList. length(); i++) Object item = aList. getItem(i); addItem (item, i);
1. (4 points) What is the big-O time efficiency of algorithm A in terms of the length n of the list? Explain your answer briefly.
2. (4 points) What is the big-o time efficiency of algorithm B in terms of the length n of the list? Explain your answer briefly.
3. (2 points) is one of the algorithms more efficient than the other? Explain briefly.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 19:40, Dogtes9667
Consider the following generator matrix: g= (1 0 0 0 1 0 0 0 1 1 1 1 1 0 1 1 1 0) find all the codewords generated by this generator matrix. determine the number of errors that this code will detect. determine the number of errors that this code will correct. prove that a linear code's minimum weight is equivalent to its minimum distance. that is, where c is a linear code, dist(c) = wh(c)
Answers: 1
image
Computers and Technology, 23.06.2019 02:50, CrusaderLord
Define a class named movie. include private fields for the title, year, and name of the director. include three public functions withprototypes void movie: : settitle(cstring); , voidmovie: : setyear(int); , void movie: : setdirector(string); . includeanother function that displays all the information about a movie. write a main() function that declares a movie object namedmyfavoritemovie. set and display the object's fields. this is what i have but know its wrong since it will notcompile: #include#includeusing namespace std; //class declarationclass movie{private: string movietitle ; string movieyear; string directorname; public: void settitle(string title); void setyear(string year); void setdirector(string director); void displayinfo(); }; //class implementationvoid movie: : settitle(string title){ movietitle = title; cout< < "what is the title of themovie? "< > temp; myfavoritemovie. settitle(temp); cout< < "enter movie year"< > temp; myfavoritemovie. setyear(temp); cout< < "enter director'sname"< > temp; myfavoritemovie. setdirector(temp); //display all the data myfavoritemovie. displayinfo(); system("pause"); return 0; this code is not entirely mine someone on cramster edited my firstcode but then i try manipulating the new code and i still get acompile error message : \documents\visual studio 2008\projects\movie\movie\movie. cpp(46) : error c2679: binary '< < ' : no operator found which takes aright-hand operand of type 'std: : string' (or there is no acceptableconversion)c: \program files (x86)\microsoft visual studio9.0\vc\include\ostream(653): could be'std: : basic_ostream< _elem,_traits> & std: : operator< < > (std: : basic_ostream< _elem,_traits> & ,const char *)w
Answers: 1
image
Computers and Technology, 23.06.2019 09:30, blake2001
Which of the following tasks is an audio technician most likely to perform while working on a nature documentary? (select all that apply). eliminating potentially distracting background noise adding sound effects making sure the lighting is adequate for a particular scene changing the narration to better match the mood of the documentary
Answers: 3
image
Computers and Technology, 23.06.2019 15:10, cathyjuan
What role did women fill during world war ii?
Answers: 1
Do you know the correct answer?
Suppose that you want to add an LLList constructor that takes a reference to an ArrayList as its onl...

Questions in other subjects: