Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Q. Write an algorithm that counts number of nodes in a linked list.
Ans.
Algorithm to Count No. of Nodes in Linked List
COUNT (INFO, LINK, START, NUM)
1. Set NUM: = 0 [initializes counter]
2. Set PTR=START [ initializes pointer]
3. Repeat steps 4 & 5 while PTR! = NULL
4. Set NUM:= NUM + 1 [ increases NUM by 1]
5. Set PTR: =LINK [PTR] . [updates pointer to point to next node]
[End of step 3 loop]
6. Return
What is complexity of an algorithm? What is the basic relation between the time and space complexities of an algorithm? Justify your answer by giving an example.
Q. Which are the two standard ways of traversing a graph? Explain them with an example of each. Ans: T he two ways of traversing a graph are written below
Illustrate an example of algorithm Consider that an algorithm is a sequence of steps, not a program. You might use the same algorithm in different programs, or express same alg
For splaying, three trees are maintained, the central, left & right sub trees. At first, the central subtree is the complete tree and left and right subtrees are empty. The target
Instructions : You have to design a doubly linked list container. The necessary classes and their declarations are given below The main() function for testing the yo
Write an algorithm, using a flowchart, which inputs the heights of all 500 students and outputs the height of the tallest person and the shortest p erson in the school.
The Ruby Programming Language Although data structures and algorithms we study aren't tied to any program or programming language, we need to write particular programs in speci
i:=1 while(i { x:=x+1; i:=i+1; }
The number of interchanges needed to sort 5, 1, 6, 2 4 in ascending order using Bubble Sort is 5
for i=1 to n if a[i}>7 for j=2 to n a[j]=a{j}+j for n=2 to n a[k]=a[j]+i else if a[1]>4 && a[1] for 2 to a[1] a[j]= a{j]+5 else for 2to n a[j]=a[j]+i ..
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd