Showing posts with label 17/18 SEM 1 BCS1223. Show all posts
Showing posts with label 17/18 SEM 1 BCS1223. Show all posts

11/22/2017

BCS1223 Data Structure And Algorithms : Lab 22 Nov 2017


1. Write a program to sort an array as follows.

a. Use Selection sort to sort the array using the function selctionSort given in class. Print the number of comparisons and the number of item movements.

b. Use Bubble sort  to sort the array using the function bubbleSort given  in class. Print the number of comparisons and the number of item movements.

c. Test your program on a list of 1,000 elements and on a list of 10,000 elements.


11/08/2017

BCS1223 Data Structure And Algorithms : Assignment 2

Write a program to find the number of comparisons using the binary search and sequential search algorithms as follows:
Suppose list is an array of 1000 elements.

a. Use a random number generator to fill list. (You may refer to http://www.cplusplus.com/reference/cstdlib/rand/)
b. Use any sorting algorithm to sort list. (You may refer to http://www.geeksforgeeks.org/sort-c-stl/)
c. Search the list for some items, as follows:

     i. Use the sequential search algorithm to search the list. (You might need to modify the seqSearch   function given in  http://mohdnazri.blogspot.my/2017/11/bcs1223-data-structure-and-algorithms.html to count the number of comparisons.)

     ii. Use the binary search algorithm to search the list. (You might need to modify the binSearch function  given in http://mohdnazri.blogspot.my/2017/11/bcs1223-data-structure-and-algorithms.html    to count the number of comparisons.)

     iii. Use the binary search algorithm to search the list, switching to a sequential search when the size of the search list reduces to less than 15.(Use the sequential search algorithm for a sorted list.)


d. Print the number of comparisons for Steps c.i c.ii and c.iii. If the item is found in the list, then print its position.

due date: 23 November 2017

Students may refer to the following C++ program to get the idea.

11/01/2017

BCS1223 Data Structure And Algorithms : LAB 2 Nov 2017

1. Rewrite and run the following C++ program.



2. Rewrite and run the following C++ program.



3. The sequential search algorithm as given in Question 1 does not assume that the list is in order. Therefore, it usually works the same for both sorted and unsorted lists. However, if the elements of the list are sorted, you can somewhat improve the performance of the sequential search algorithm. For example, if the search item is not in the list, you can stop the search as soon as you find an element in the list that is larger than the search item. Write the function seqOrdSearch to implement a version of the sequential search algorithm for sorted lists.

9/13/2017

BCS1223 Lab 14 Sept 2017


Review : Objects and Classes

Give both Structured and Object Oriented solution for the following problems.
1.    Write a java program that reads the length and height of a rectangle and computes its area and parameter using the following formulas:-
Area = length x height
Perimeter = 2 x (length + height)




2.    Write a java program that reads the height of a cube  and computes its volume and parameter using the following formulas:-
Volume = height x height x height
Perimeter = 4 x height





3.    Write a program that reads in the radius and length of a cylinder and computes its volume using the following formulas:

Area = radius * radius * 3.14
Volume = area * length




Cara download Installer windows 10 dalam format ISO

1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan.  ...