Q. 1) A match box contains 50 match sticks. Write an algorithm (using basic constructs of sequence, selection, and repetition) to compute the match boxes required required to create an N * N matrix of the following type (this is 2 * 2 matrix).
Ans: Let us build a table indicating how many matches are need to build each set of squares:
Number of squares Number of matchsticks 1
4
2
12
3
24
4
40
5
60
6
84
7
112
If you watch carefully you will be able to see that each time we add a new layer of boxes to make a n x n matrix , we add 4n new matchsticks. That is when there i s one box on the table and we add matchsticks to make a 2 x 2 matrix, 8matchsticks have to be added. Similarly to go from a 2 x 2 array to a 3 x 3requires adding 12 matchsticks. Thus we can conclude that if it takes p matchsticks to f orm a matrix of (m-1)squares, then the number of matchsticks in a matrix of m squares is p + 4m. Thus starting with a square (1 x 1) of 4 matchsticks, the
number in the next larger size is 4 + 4 X 2 = 12, and the next level (3 x 3 square) requires 12 + 4 x 3 = 24 matchsticks. Thus an algorithm for computing the number of matchsticks in a square of size n x n is: matchsticks = 0 for i = 1 to n matchsticks = matchsticks + 4 x i
Alternatively we can compute the number of matchsticks needed for boxes of size greater than 4 by constructing a difference table, and noting that the second difference is a constant (4): Number of Squares
Number of 1st Difference 2nd Difference Matchsticks
1
4 8
2
12
4 12
3
24
4 16
4
40
4
Yet again we can find a different means to compute the number of matchsticks in (n x n) matrices. Note that in each row of a (n x n) matrix there are nmatchsticks, and there are (n + 1) l ines of matchsticks. Thus the total number of matchsticks in the rows of matchsticks is n (n + 1). There is exactly the same number of matchsticks in each column. So the total number of matchsticks in a (n x n) matrix is 2n (n + 1). Q. 2) How would you measure exactly 6 liter of water when you have only two containers, a 4 liter bucket and a 9 liter bucket. Write an optimal algorithm to solve the problem? Ans: First fill the 9-liter bucket.
Then pour 4 liters over to the 4-liter bucket (there are now 5 liters i n the 9-liter bucket), and then pour out the water from the 4-liter bucket. Again pour 4 liters from the 9-liter bucket to the 4-liter bucket and empty it.
There will now be just 1 liter left in the 9-liter bucket. Now pour that remaining 1 liter to the 4-liter bucket but this time keeps it there. Fill
the 9-liter bucket again and then pour water to fill the 4-liter bucket to the top (this only needs 3 more liters). The 9-liter bucket will now contain exactly 6 liters. Go ahead and add the concrete mix, now. Q. 3) Compute the complexity of the t he following Algorithm. i= 1; While(i < n+1) { j=1; while(j < n+1) { j = j*2; } i=i+1; } Ans:
Q. 4) Given a simple s imple unsorted list order, compute the complexity of following operations. i)
Insert an item
ii) Search an item (Best (Best case, Worst case) iii) Delete an item item Ans: i) Insert an item:
Insert Item has two parts: (1) find the place to insert the item and (2) insert the item. In the unsorted list, the item is put in the n position and n is incremented. Neither of these operations depends on the number of items in the list, so the complexity is O(1). ii) Best Case Searching: Best
case as our measure of complexity, then all of the operations would have O(1) complexity. complexity.
Worst Worst
Case Searching: Se arching:
case as our measure of complexity, then all of the operations would have O(n) complexity.
iii) Delete an item Delete Item also has two parts: (1) find the item to delete and (2) delete the item. Finding the item uses
the same algorithm search, so the complexity of that part i s O(n). To delete the item, we put the value in the length - 1 position into the location of the item to be deleted and decrement n. These store and decrement tasks are not dependent on the number of items in the list, so this part of the operation has complexity O(l). The entire delete algorithm has complexity O(n) because O(n) plus O(l) is O(n). Q. 6) What is the difference between
A) Utility and Usability
B) Systems Analysis and Task Analysis
C) User Centered Design Design and Participat Participatory Design D) Browsing and Searching
E) Interface and Interaction
F) Intranet and Internet G) WWW and Distributed Hypermedia Systems H) Direct and Indirect P ointing Device J) Horizontal and Vertical Pr ototyping
I) Incremental and Evolutionary prototype K) E-commerce and E-business
Ans: Utility and Usability Good utility and usability are closely related, yet they are not the same thing. Utility and usability are similar in that they are both critical in producing a quality product; the product needs to be operated easily and intuitively (usability) to accomplish the given task (utility) (Nielsen 2003). There are however subtle differences; utility is solely concerned with usefulness; however usability includes not only utility, but also efficiency, safety, memorability, learnability and satisfaction (Nielsen 2003). Systems Analysis and Task Analysis In System Analysis more emphasis is given to understanding the details of an existing system or a proposed one and then deciding whether the proposed system is desirable or not and whether the existing system needs improvements. Thus, system analysis is the process of investigating a system, identifying problems, and using the information to recommend improvements to the system.
Task Analysis is the analysis of how a task is accomplished, including a detailed description of both manual and mental activities, task and element durations, task frequency, task allocation, task complexity, environmental conditions, conditions, necessary clothing and equipment, and any other unique factors involved in or required for one or more people to perform a given task. User Centered Design:
The design deals with all the needs and requirements of the user and solely
focuses on users needs.
Participatory Design (known before as 'Cooperative Design') is an approach to design attempting to actively involve all stakeholders (e.g. employees, partners, partners, customers, citizens, end users) in the design process in order to help ensure the product designed meets their needs and is usable usable.. Browsing and Searching browsing means that you already know where your needed information is presented and you just click through to pages to get to through through your required information whereas searching means using searchegines or other means find the required information. Interface and Interaction interface is the basic layout or the looks and the feel of the softwares where as interaction is the way or method user uses to perform a specific function. Intranet and Internet
Internet is the proper name of the network most people connect to, and
the word needs to be capitalized. However intranet, a network confined to a smaller group, is a generic term which does not deserve capitalization. and Distributed Hypermedia Systems Hypermedia is a computer-based information retrieval system that enables a user to gain or provide access to texts, audio and vi deo recordings, photographs and computer graphics related to a particular subject. Hypermedia is a term created by Ted Nelson. Hypermedia is used as a logical extension of the termhypertext term hypertext in which graphics, audio, video, plain text and hyperlinks intertwine to create a generally non-linear medium of information. WWW
Direct and Indirect Pointing Device Indirect devices The devices which need more cognitive processing are known as indirect pointing devices like mouse,track ball etc. Direct devices:: the devices which do not need more cognitive processing are known as direct pointing devices like touch pads, touch screens. Evolutionary Prototyping Model Use in projects that have low risk in such areas as losing budget, schedule predictability and control, large-system integration problems, or coping with information sclerosis, but high risk in user interface design. Incremental/iterative Development The process for constructing several partial deliverables, deliverables, each having incrementally more functionality.
Horizontal Prototype common term for a user interface prototype is the horizontal prototype. It provides a broad view of an entire system or subsystem, focusing on user interaction more than l ow-level system functionality, such
A
as database access. Horizontal prototypes are useful for:
Confirmation of user interface requirements and system scope
Demonstration version of the system to obtain buy-in from the business
Develop preliminary estimates of development time, cost and effort.
Vertical A
Prototype
vertical prototype is a more complete elaboration of a single subsystem or function. It is useful for
obtaining detailed requirements for a given function, with the following benefits:
Refinement database design Obtain information on data volumes and system interface needs, for network sizing and performance engineering Clarifies complex requirements by drilling down to actual system functionality
e-commerce refers to online transactions - buying and selling of goods and/or services over the
Internet.
e-business covers online transactions, but also extends to all Internet I nternet based interactions with
business partners, suppliers and customers such as: selling direct to consumers, manufacturers and suppliers; monitoring and exchanging information; auctioning surplus inventory; and collaborative product design. These online interactions are aimed at improving or transforming business processes and efficiency.