## State flowchart that take temperature input using pseudocode, Data Structure & Algorithms

Assignment Help:

Write an algorithm using pseudocode which takes temperatures input over a 100 day period (once per day) and output the number of days when the temperature was below 20C and the number of days when the temperature was 20C or above.

(NOTE: since the number of inputs is known, a for ... to loop can be used. However, a while loop or a repeat loop would work just as well).

total1 = 0: total2 = 0

for days = 1 to100

input temperature

if temperature < 20 then total1 = total1 + 1

else total2 = total2 + 1

endif

next

print total1, total2

This is a good illustration of an algorithm which could be written using the case construct instead of if ... then ... else. The following section of code replaces the statements if temperature < 20 then ...... endif:

case temperature of

1: total1 = total1 + 1

2: total2 = total2 + 1

Endcase

#### Array implementation of a dequeue, If a Dequeue is implemented via arrays, ...

If a Dequeue is implemented via arrays, then this will suffer with the similar problems which a linear queue had suffered. Program 8 gives the array implementation of Dequeue.

#### Representation of max-heap sequentially, Q. How do we represent a max-heap ...

Q. How do we represent a max-heap sequentially? Explain by taking a valid   example.         Ans: A max heap is also called as a descending heap, of size n is an almos

#### Conversion of general trees into the binary trees, By taking an appropriate...

By taking an appropriate example explain how a general tree can be represented as a Binary Tree.                                                                    C onversio

#### Merge sort, Merge sort is a sorting algorithm which uses the basic idea of ...

Merge sort is a sorting algorithm which uses the basic idea of divide and conquers. This algorithm initially divides the array into two halves, sorts them separately and then merge

#### Balance theorem, Question 1 Discuss the following theorems with respect to...

Question 1 Discuss the following theorems with respect to Splay Trees- Balance Theorem Dynamic Finger Theorem   Question 2 Write a C program for implementation

#### Simplifying assumptions of wire frame representation, Simplifying Assumptio...

Simplifying Assumptions of wire frame representation Neglect colour - consider Intensity: For now we shall forget about colour and restrict our discussion just to the intensi

#### Algorithm that inputs the codes for all items in stock, A shop sells books,...

A shop sells books, magazines and maps. Every item is identified by a unique 4 - digit code. All books have a code which starts with 1, all maps have a code starting with 2 and all

#### Algorithm for insertion into the circular queue, Algorithm for insertion of...

Algorithm for insertion of any element into the circular queue: Step-1: If "rear" of the queue is pointing at the last position then go to step-2 or else Step-3 Step-2: make

#### Recurrence relation, solve the following relation by recursive method: T(n...

solve the following relation by recursive method: T(n)=2T(n^1/2)+log n

#### The various ways in which lc code can be accessed, Problem Your LC code...

Problem Your LC code is stored in a memory location as shown and the variable name is LC                  LC Memory address       Content(LC code)