Q1. Describe an algorithm in pseudo-code
then implement it as a program, one that
can directly evaluate infix expressions
of the form:
A+B-C/D-X, where only arithmatic operators
are used and there are no parantheses.
Q2. Write a program that can effic
Problem St 2
Q1. How can you implement 2 Stacks with 1 Array? Optimize for space.
Q2. Find if a word is a palindrome using a stack.
Q3. Design and implement a calculater that calculates expressions of the form:
+ 2 4
* 8 ( + 7 12)
( + 7 ( * 8 12 ) (
Q1. Sort a single-linked list containing
any number of copies of the numbers cfw_0,1,2,3
in O(N) time.
Q2. Write a program to print elements of a linked list
in reverse order, by making use of the same linked list
(which may implement any ADT of your c
Q1. Design & implement a program that constrcuts binary trees capable
of holding postfix arithmatic expressions, such as 14 23 + 7 - 12 *
Q2. Design & implement a binary tree utilizing program to hold
a string of integers (e.g., 181 728 67 1 3 8 377 18
Q1. Integers in an array are unique and increasingly sorted. Please write a function/method to find an integer from the array who equals to its index. For example, in the array cfw_-3, -1, 1, 3, 5, the number 3 equals its index 3.
Q2. Implement a Dequeue
Project 1. Evolve & Test Sorting Networks using a Genetic Algorithm
I have explained Genetic Algorithms & Sorting Networks, in detail, in class.
If you have not been to class then a Genetic Algorithm (GA) is explained in:
Q1. Given a connected graph G1, with edges
cfw_(A,B), (B,C), (C,F), (C,D), (D,E), (B,E)
write & test a program that finds whether
the graph has a cycle or not. Is there a
way to return an answer without traversal?
Q2. Given a connected graph G2, with d
Q1. Implement a Heap Sort using an array and in-place sorting.
Test it and output the results.
Q2. Implement a min heap: insert the following elements into
it in order: 4,9,2,89,12,69,32,1,56,12,-12,190,-5,77.
Q3. Given an array of size n, split it into
Q1. Implement a deque using a double-linked list.
Q2. Design, implement and test a linked list that allows
for the insertion of multiple objects with the same key at
the same location.
For example, if a list = [184.108.40.206.29.10]
then both items with key 6
Problem Set 1
Q1. You have 8 coins which are all the same weight, except for one which is slightly
heavier than the others (you don't know which coin is heavier). You also have an
old-style balance, which allows you to weigh two piles of coins to see w
Q1. Lets consider K-based numbers, containing exactly N digits. We define a number to be valid if its K-based notation doesnt contain two successive zeros. For example:
1010230 is a valid 7-digit number;
1000198 is not a valid number;
0001235 is not a 7-d
Q1. Build a hash table with open addressing and a size of 99. Use the hash function "k%99". Insert the following keys, in order: 15, 229, 320, 0, 127 and 18 into your table.
Q2. Design and imeplement a perfect hashing based algorithm that accepts a Conco
Q1. Design, build and test a recursive function that returns the
greatest common divisor (GCD) of two integers.
Q2. Design, build and test a recursive function that returns the
nth prime number, with 1 being the first prime. Beware of the computational