Answer to Question #174817 in C++ for Prisy

Question #174817
  1. Write a C++ code structure to test for overflow condition on queue
  2. Write an algorithm to insert element at the beginning of a 1-D array
  3.  Write an algorithm to implement linear search of elements in a 1-D array 
  4. Draw a tree structure and use it to illustrate each of the following: 

      Height, Level, External node(s), Internal node(s), Depth of a node, Degree of a node, Ancestor(s) of a node, Descendant(s) of a node 



1
Expert's answer
2021-03-26T16:23:15-0400

1.Code structure for overflow condition in queue

top == n-1

2.Insertion at begining algo

begin IF N = MAX, return ELSE N = N + 1 

For All Elements in A Move to next adjacent location A[FIRST] = New_Element 

end 

3.linear search algo

Step 1: Set i to 1 

Step 2: if i > n then go to step 7 

Step 3: if A[i] = x then go to step 6 

Step 4: Set i to i + 1 

Step 5: Go to Step 2

 Step 6: Print Element x Found at index i and go to step 8 

Step 7: Print element not found 

Step 8: Exit

4) draw a tree structure



Height=4

Level=4

Degree Of A=2

B and C internal node


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS