(a) Read a predefined number of integers from the standard input (std in) and do the following:
(i) Print the sum of the numbers
(ii) Print the average of the numbers
(iii) Sort the numbers using insertion sort
(iv) Find the median of the numbers
(b) Given an integer n, find the n-th Fibonacci number
(c) Given two numbers find their GCD
(a) Implement linear search over an array of integers
(b) Implement binary search over an array of sorted integers
(a) We say that a string s is a "good password" if it is a string of printable ASCII characters with the following characteristics: (i) The string is at least 8 characters long (ii) The string contains both upper and lower case alphabets (iii) The string contains at least one numeral (iv) The string contains at least one character which is neither an alphabet nor a numeral.
Given a string, find whether it is a good password. (Get yourself familiar with the ASCII encoding and ctype.h )
(b) Implement the stack interface discussed in class, assuming the stack has a fixed capacity.
a) Implement the stack interface with array resizing as discussed in class.
(b) Use the stack interface to test if a given mathematical expression has correct pathenthization.
(c) Implement a queue to store integers using two stacks. You should define a structure for queue as:
typedef struct { stack *s1;
stack *s2} queue;
You should write the following functions:
The operations to implement would be: void newQueue(), void enqueue(queue q, int a), int dqueue(queue q)
Implement the queue ADT as discussed in class.
Implement stacks and queues using linked list. Try the problems listed here.
Implement general list with linked list.
Implement a generic linear search as described in class.