CSC 212 Project
Developing a Ratings Query Application
College of Computer and Information Sciences
King Saud University
Fall 2016
1
Introduction
Most major websites collect feedback from their customers in order to improve the quality
of their services.
CSC 212 Final - Fall 2014
College of Computer and Information Sciences, King Saud University
Exam Duration: 3 Hours
03/01/2015
1. All answers must be written on the answer sheet.
2. The use of calculators is prohibited.
Question 1
[16 points]
1. Give the
CS212:Data Structure
Elements: The elements are of generic type <Type>
(The elements are placed in nodes for linked list
implementation).
Structure: the elements are linearly arranged. The
first element is called head, there is a element
called current.
D
CSC 212 Midterm 2 - Fall 2014
College of Computer and Information Sciences, King Saud University
Exam Duration: 90 Minutes
07/12/2014
Question 1
[35 points]
1. Write the static method moveAfter (user of the Stack ADT), that takes as input two
stacks st1 ,
Heaps
A heap is a binary tree.
A heap is best implemented in sequential
representation (using an array).
Two important uses of heaps are:
(i) efficient implementation of priority queues
(ii) sorting - Heapsort.
1
A Heap
10
30
40
52
Any nodes key valu
CSC 212 Midterm 2 Solution - Fall 2014
College of Computer and Information Sciences, King Saud University
Exam Duration: 90 Minutes
07/12/2014
Question 1
1.
[35 points]
public static <T > void moveAfter ( Stack <T > st1 , Stack <T > st2 , int i ) cfw_
Sta
CSC 212 Final - Fall 2013
College of Computer and Information Sciences, King Saud University
Exam Duration: 3 Hours
04/01/2014
Question 1
[10 points]
Select the most appropriate answer.
1. If we use the folding hash function H(key) = d1 d2 + d3 d4 where d
Question 1
1. (a) 199
Since 99 + 99 = 198, and the keys are in the range 0-198
2. (b) 9
Evaluate it using a stack. See slides.
3. (b) O(logn)
See slides. It can also be O(n) in special cases.
4. (b) B+ Tr
Question 1
1.
In a binary search tree, the worst-case time-complexity in general for the
operations search and insert
Answer
O(logn) and O(n), respectively.
Both O(logn).
O(logn) and O(nlogn), respectively.
Both O(n).
1 points
Question 2
1.
In a binary se
CSC 212 Tutorial #9
Binary Search Tree
30/11/2014
Important: This tutorial has an online part, which you should complete on the LMS.
Problem 1
public int maxKey() cfw_
return maxKey(root);
private int maxKey(BSTNode<T> n) cfw_
if(n.right = null)
return n
CSC 212 Tutorial # 11
Binary Trees
14/12/2014
Important: This tutorial has an online part, which you should complete on LMS
(tutorial section). The deadline for this task is December 18th at midnight.
Problem 1
Insert the following Keys in a B+ Tree of or
Question 1
1.
For a method in BinaryTree ADT, fill in the blanks for the method print and
print_rec.
The method will print the element of the tree using "in-order" order.
public void print()cfw_
print_rec(
);
private void print_rec(
if ( p =
p)cfw_
)
ret
Question 1
1.
What is Recursion ?
Answer
Recursion is a class
Recursion is a process of defining a method that calls other methods
repeatedly.
Recursion is a process of defining a method that calls itself repeatedly.
Recursion is a process of defining a m
CSC 212 Tutorial # 8
Binary Trees
23/11/2014
Important: This tutorial has an online part, which you should complete on LMS
(tutorial section). The deadline for this task is Sunday October 26th at midnight.
Problem 1
Write the method LeafNodes part of the
CSC 212 Tutorial #6
Stack
9/11/2014
Important: This tutorial has an online part, which you should complete on the LMS.
Problem 1
Write a static method replace (user of ADT) that takes as input a stack st and two elements x and
y. The method replaces all t
Problem 3
Analyze the performance of the following algorithms theoretically:
Statements
S/E
1 public void func1(int n) cfw_
2 for (int i = 0; i < n * log(n); i+) cfw_
3 System.out.println(i);
4 for (int j = 2; j < n; j+)
5 System.out.pr
CSC 212
JUnit Tutorial for Unit Testing
Due date: 26/2/2017
1
Introduction
JUnit is an open source testing framework which is used to write and run repeatable
automated tests, so that we can be ensured that our code works as expected.
2
JUnit Simple Examp
CSC 212 Homework # 1
Performance Analysis
Due date: 16/10/2016
This is an individual assignment.
Guidelines: The homework must be submitted electronically through
LMS.
Hard copy submissions are not accepted.
Problem 1
1. Order the following functions by a
CSC 212 Homework # 4 Solution to Selected
Problems
BT & BST
Problem 1
1.
2.
private void swap ( BTNode <T > t ) cfw_
if ( t = null )
return ;
if ( t . left != null ) cfw_
T tmp = t . data ;
t . data = t . left . data ;
t . left . data = tmp ;
else if ( t
Problem 1
1.
2.
3.
0
X
1
12
2
20
3
18
4
23
5
28
6
15
a. increasing order -> MAX heap
b. bottom up construction for heap
0
X
c.
Draw the array after removing each element (the array must be sorted in-place, so
show the co
King Saud University
College of Computer and Information Sciences
Computer Science Department
CSC 212
First Semester 1437-1438
Tutorial # 12
Important: No online tutorial
Problem 1
Use the hash function H(key) = key mod 11 to store the sequence of integer
Problem 4
a. Can a BST satisfy heap conditions? Give an example if yes.
No; there is no guarantee the BST is complete tree.
BST propriety: Key (left) < Key (parent) < Key (right)
Heap propriety: Key (Parent) < Key (left) & Key (right)
If we satisfy Key (P
Problem 1
Insert 35 -double rotation
Delete 50 case 3 two children double rotation
* Always select min node in right subtree
Problem 3
Insert 30: overflow split transfer-update
Insert 48 : overflow transfer update
Delete 19: underflow
King Saud University
Department of Computer Engineering
College of Computer and Information Sciences
CEN200: Introduction to Computer Engineering
Section: 33622, Instructor: Dr. Haikel Hichri, Email: [email protected]
Section: 32687, Instructor: Dr. Abdu
King Saud University
College of Computer and Information Sciences
Computer Science Department
CSC 212
First Semester 1437-1438
Tutorial # 12
Important: No online tutorial
Problem 1
Use the hash function H(key) = key mod 11 to store the sequence of integer
King Saud University
College of Computer and Information Sciences
Computer Science Department
CSC 212
First Semester 1437-1438
Tutorial # 7
Important: This tutorial has an online part, which you should complete on LMS
(tutorial section). The deadline for
King Saud University
College of Computer and Information Sciences
Computer Science Department
CSC 212
First_Semester 1437-1438
Tutorial #6
Important: This tutorial has an online part, which you should
complete on LMS (tutorial section). The deadline for o
King Saud University
College of Computer and Information Sciences
Computer Science Department
CSC 212
Second_Semester 1437-1438
Tutorial #4
Important: This tutorial has an online part, which you should complete on LMS
(tutorial section). The deadline for