<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-21654981</id><updated>2011-04-21T13:15:32.257-07:00</updated><title type='text'>Puzzling puzzling...</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://puzzlingu.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://puzzlingu.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>srividya</name><uri>http://www.blogger.com/profile/02823093035826368711</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-21654981.post-114053193631925695</id><published>2006-02-21T06:00:00.000-08:00</published><updated>2006-05-24T22:45:07.806-07:00</updated><title type='text'>some queries...</title><content type='html'>&lt;span style="color: rgb(0, 51, 51);"&gt;-- What is the output?&lt;br /&gt;&lt;br /&gt; Class X&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 51);"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 51);"&gt;  };&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 51);"&gt;  printf("%d",sizeof(X));&lt;br /&gt;&lt;br /&gt;&lt;sizeof x=""&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Ans: 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- How to find factorial of a number greater than 13?&lt;br /&gt;&lt;br /&gt;-- Can you  display "Hello" message in C/C++ with empty main() function.&lt;br /&gt;For example&lt;br /&gt;void main(void)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Solutions:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;C&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;#define main() main(){printf("Hello");} void abc()&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/sizeof&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 51);"&gt;&lt;span style="color: rgb(0, 0, 102);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;C&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;int i = printf("Hello");    //Global variable i&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 51);"&gt;&lt;span style="color: rgb(0, 0, 102);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 51);"&gt;&lt;sizeof x=""&gt;&lt;br /&gt;&lt;/sizeof&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 51);"&gt;&lt;span style="color: rgb(0, 0, 102);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;C++&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;class Sample&lt;br /&gt;{&lt;br /&gt;    public:&lt;br /&gt;        Sample() { printf("Hello"); }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;Sample s;    //Global object&lt;br /&gt;&lt;br /&gt;void main(void)&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21654981-114053193631925695?l=puzzlingu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://puzzlingu.blogspot.com/feeds/114053193631925695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21654981&amp;postID=114053193631925695' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/114053193631925695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/114053193631925695'/><link rel='alternate' type='text/html' href='http://puzzlingu.blogspot.com/2006/02/some-queries.html' title='some queries...'/><author><name>srividya</name><uri>http://www.blogger.com/profile/02823093035826368711</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21654981.post-113906085892623519</id><published>2006-02-04T05:45:00.000-08:00</published><updated>2006-02-04T05:47:38.926-08:00</updated><title type='text'>U got 2 code these!!! - 3</title><content type='html'>&lt;span class="contentText"&gt;3&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;Given a dictionary of words and a character set, design and implement&lt;br /&gt;the most efficient search model to retrieve all dictionary words for a given&lt;br /&gt;character set; for example, given a character set, {'o', 'd', 'g'}, "dog" and&lt;br /&gt;"god", "go" and "do" (but not "good" } are the words that would be&lt;br /&gt;output (considering that these words exist in the dictionary).&lt;br /&gt;&lt;br /&gt;The dictionary is static and is input from a file present in the same&lt;br /&gt;directory as the program. The file is an ASCII text file with each word&lt;br /&gt;on a separate line. The words in the file are sorted in lexicographical order.&lt;br /&gt;Dictionary as well as the character set contains only English alphabets&lt;br /&gt;(upper and lower case not distinguished). There is no limit on the number&lt;br /&gt;of words in the dictionary, and you should make your program scale to&lt;br /&gt;large dictionaries. For example, the file could look like the following.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Aberration&lt;br /&gt;Abrasion&lt;br /&gt;An&lt;br /&gt;And&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;The character set is given as a sequence of characters (with no separator&lt;br /&gt;between them). For example, it could be "odg" for a set that represents&lt;br /&gt;three characters 'o', 'd' and 'g'.&lt;br /&gt;&lt;br /&gt;The output of the program should be written to an ASCII text file in the&lt;br /&gt;same directory sorted in lexicographical order, which contains all the&lt;br /&gt;dictionary words for a given character set - one word per line.&lt;br /&gt;&lt;br /&gt;You can use the standard file I/O functions for your program.&lt;br /&gt;&lt;br /&gt;The commandline of the program will be as follows&lt;br /&gt;&lt;br /&gt;problem2 &lt;input-filename&gt; &lt;character-set&gt; &lt;output-filename&gt;&lt;br /&gt;&lt;br /&gt;For eg., problem2 dict.txt odg output.txt&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21654981-113906085892623519?l=puzzlingu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://puzzlingu.blogspot.com/feeds/113906085892623519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21654981&amp;postID=113906085892623519' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113906085892623519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113906085892623519'/><link rel='alternate' type='text/html' href='http://puzzlingu.blogspot.com/2006/02/u-got-2-code-these-3.html' title='U got 2 code these!!! - 3'/><author><name>srividya</name><uri>http://www.blogger.com/profile/02823093035826368711</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21654981.post-113906059447185802</id><published>2006-02-04T05:41:00.000-08:00</published><updated>2006-02-04T05:43:14.470-08:00</updated><title type='text'>U got 2 code these!!! - 2</title><content type='html'>&lt;span class="contentText"&gt;2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;Design and implement an efficient algorithm to remove consecutive 1char,&lt;br /&gt;2char, 3 char... so on recurrences in dictionary words.&lt;br /&gt;For example, "abbabccbc" first will become "ababcbc", then become "abc".&lt;br /&gt;Similarly, "abcaab" will become "abcab" and but stays as it is after that.&lt;br /&gt;You need to output only the last string ("abc" and "abcab" for the above&lt;br /&gt;two examples).&lt;br /&gt;&lt;br /&gt;The input to the file will be an ASCII string (of arbitrary size) from standard&lt;br /&gt;input and output string should be sent to standard output.&lt;br /&gt;&lt;br /&gt;The commandline of the program will be as follows&lt;br /&gt;&lt;br /&gt; problem3 &lt;input-str&gt;&lt;br /&gt;For eg., problem3 abbcabcc &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21654981-113906059447185802?l=puzzlingu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://puzzlingu.blogspot.com/feeds/113906059447185802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21654981&amp;postID=113906059447185802' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113906059447185802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113906059447185802'/><link rel='alternate' type='text/html' href='http://puzzlingu.blogspot.com/2006/02/u-got-2-code-these-2.html' title='U got 2 code these!!! - 2'/><author><name>srividya</name><uri>http://www.blogger.com/profile/02823093035826368711</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21654981.post-113906045382806656</id><published>2006-02-04T05:27:00.000-08:00</published><updated>2006-02-04T05:53:13.450-08:00</updated><title type='text'>U got 2 code these!!! - 1</title><content type='html'>&lt;span class="contentText"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;Consider a system where users query for and buy Songs. The system&lt;br /&gt;stores the purchase transactions that have happened so far in the form&lt;br /&gt;of a tuple (Ux,Sy) form meaning User x bought Song y.&lt;br /&gt;&lt;br /&gt;Question: Whenever a user reviews content of a song S1, we want to&lt;br /&gt;present the user the top 5 songs that other users have bought who also&lt;br /&gt;have bought song S1. The program should not terminate and after&lt;br /&gt;printing out the list of users, wait for the next input. The input could&lt;br /&gt;also be a purchase transaction which would necessitate updating the&lt;br /&gt;transaction history. Further details are given below&lt;br /&gt;&lt;br /&gt;Input:&lt;br /&gt;&lt;transaction-history&gt; This is the name of a file that contains all&lt;br /&gt;transactions that have happened so far in that system; this will be in&lt;br /&gt;the form of a text file which contains one transaction per line. Each&lt;br /&gt;transaction is a tuple containing the user ID and the song ID (both&lt;br /&gt;are 32 bit numbers) separated by a space. For e.g., line "123 452"&lt;br /&gt;(file contains no quotes) represents that user with ID 123 has bought&lt;br /&gt;song ID 452.&lt;br /&gt;&lt;purchase-history&gt; This is the name of the file that contains the&lt;br /&gt;purchase transactions that have to be updated to the system. The format&lt;br /&gt;of this file is the same as that of transaction-history file.&lt;br /&gt;&lt;song-id&gt; The current query - the song ID that is being queried&lt;br /&gt;&lt;br /&gt;Output:&lt;br /&gt;Top 5 songs (sorted in decreasing number of purchases of that song and&lt;br /&gt;separated by spaces) that other users bought who have also bought the&lt;br /&gt;song that was input&lt;br /&gt;&lt;br /&gt;Design characteristics:&lt;br /&gt;a. The transaction history can contain up to 1,000,000 transactions.&lt;br /&gt;b. Every day on an average 100,000 users use the system to review&lt;br /&gt;content of some songs (not necessarily buy). Every user has got a&lt;br /&gt;unique ID and every song has got a unique ID.&lt;br /&gt;c. The solution should work for 1,000,000 songs and 100,000 users.&lt;br /&gt;d. Every day 100,000 users review song details&lt;br /&gt;e. Every day 10,000 users buy songs. (means every day there will be&lt;br /&gt;10000 purchase transactions)&lt;br /&gt;&lt;br /&gt;Example: In this example there are 4 users and 4 songs and whenever&lt;br /&gt;a user selects a song one top other song that users bought when they&lt;br /&gt;bought the selected song is displayed (note: u and s are given below for&lt;br /&gt;illustration, the real file contains only numbers corresponding to unique&lt;br /&gt;user and song IDs)&lt;br /&gt;Transaction history: (U1, S1), (U1, S3), (U2, S2), (U3, S3), (U3, S4),&lt;br /&gt;(U4, S1), (U4, S2) and (U4, S3)&lt;br /&gt;song: S3 (only U1, U3, U4 bought this song)&lt;br /&gt;output: S1 (was bought by U1 and U4, two people)&lt;br /&gt;&lt;br /&gt;Commandline of the program&lt;br /&gt;&lt;br /&gt;The program is invoked with the filename of the transaction-history file.&lt;br /&gt;After the transaction history is read into the program, program waits for&lt;br /&gt;input - which is of one of the following types:&lt;br /&gt;1. query &lt;song-id&gt; command - will print to standard output the list of&lt;br /&gt;songs that other users bought who also bought this song (top 5 - sorted&lt;br /&gt;in decreasing number of purchases of that song); print a new-line after&lt;br /&gt;the list&lt;br /&gt;2. purchase &lt;purchase-file&gt; command gives an input file that lists the&lt;br /&gt;latest purchases that have happened. The file has the same format as the&lt;br /&gt;transaction history. The program should update the history with the&lt;br /&gt;purchases listed in the file&lt;br /&gt;3. exit command exits the program&lt;br /&gt;&lt;br /&gt;An example run of the program could be as follows (the numbers are&lt;br /&gt;for illustration only)&lt;br /&gt;&lt;br /&gt;problem1 history.txt&lt;br /&gt;query 1907&lt;br /&gt;12 23990 2311&lt;br /&gt;query 67621&lt;br /&gt;123 52322 5378&lt;br /&gt;purchase pur0202.txt&lt;br /&gt;query 9792&lt;br /&gt;89023 3289 23424&lt;br /&gt;query 2308&lt;br /&gt;91 391 1 1232&lt;br /&gt;exit &lt;/purchase-file&gt;&lt;/song-id&gt;&lt;/song-id&gt;&lt;/purchase-history&gt;&lt;/transaction-history&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21654981-113906045382806656?l=puzzlingu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://puzzlingu.blogspot.com/feeds/113906045382806656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21654981&amp;postID=113906045382806656' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113906045382806656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113906045382806656'/><link rel='alternate' type='text/html' href='http://puzzlingu.blogspot.com/2006/02/u-got-2-code-these-1.html' title='U got 2 code these!!! - 1'/><author><name>srividya</name><uri>http://www.blogger.com/profile/02823093035826368711</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21654981.post-113861540060380780</id><published>2006-01-30T02:02:00.000-08:00</published><updated>2006-01-30T02:03:20.610-08:00</updated><title type='text'></title><content type='html'>&lt;span class="controlTextGrayPad"&gt;An array of size N has distinct values 1…N in random order. You have&lt;br /&gt;only operator                     called rev(X) (where X is any value from 0 to N-1) which&lt;br /&gt;reverses all values from                     0 to X (example values 2,3,1,4 and rev(2) gets&lt;br /&gt;you 1,3,2,4). Our objective is to                     sort the array using minimum number of&lt;br /&gt;Rev(X) functions. How many permutations of                     N size array require exactly&lt;br /&gt;N number of rev(X) operators to get sorted                   &lt;br /&gt;                             a.      for size 3 only 1,3,2 requires 3 moves.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21654981-113861540060380780?l=puzzlingu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://puzzlingu.blogspot.com/feeds/113861540060380780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21654981&amp;postID=113861540060380780' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113861540060380780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113861540060380780'/><link rel='alternate' type='text/html' href='http://puzzlingu.blogspot.com/2006/01/array-of-size-n-has-distinct-values-1n.html' title=''/><author><name>srividya</name><uri>http://www.blogger.com/profile/02823093035826368711</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21654981.post-113853441971968052</id><published>2006-01-29T03:09:00.000-08:00</published><updated>2006-01-29T19:52:14.213-08:00</updated><title type='text'>Algorithms...</title><content type='html'>&lt;span class="jeevetextbody"&gt;1&lt;br /&gt;Give a one-line C expression to test whether a number is a power of 2.&lt;br /&gt;Now implement it without using loops.&lt;br /&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000007.ubb&amp;q_id=7"&gt;Answers here&lt;/a&gt;&lt;/span&gt;&lt;a href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;amp;amp;number=4&amp;topic=000007.ubb&amp;amp;q_id=7"&gt;&lt;span class="down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="jeevetextbody"&gt;&lt;br /&gt;2&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Implement an algorithm to sort a linked list.&lt;br /&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000008.ubb&amp;q_id=8"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;3&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Reverse a string.&lt;br /&gt;&lt;/span&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;amp;number=4&amp;topic=000010.ubb&amp;amp;q_id=10"&gt;&lt;span class="jeevetextbody"&gt;Answers here&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span class="jeevetextbody"&gt;&lt;br /&gt;4&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Given a linked list which is sorted, how will you insert in sorted way.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000011.ubb&amp;q_id=11"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;5&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Implement an algorithm to insert in a sorted list.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;amp;number=4&amp;topic=000019.ubb&amp;amp;q_id=19"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;6&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Delete an element from a doubly linked list.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000020.ubb&amp;q_id=20"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;7&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Implement an algorithm to sort an array.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;amp;number=4&amp;topic=000022.ubb&amp;amp;q_id=22"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;8&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Given a sequence of characters, how will you convert the lower case characters to upper case characters?&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000023.ubb&amp;q_id=23"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;9&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Write a routine that prints out a 2-D array in spiral order.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;amp;number=4&amp;topic=000024.ubb&amp;amp;q_id=24"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;10&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Give a fast way to multiply a number by 7.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000025.ubb&amp;q_id=25"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;11&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Write a function that takes in a string parameter and checks to see whether or not it is an integer, and if it is then return the integer value.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;amp;number=4&amp;topic=000028.ubb&amp;amp;q_id=28"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;12&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;How would you print out the data in a binary tree, level by level, starting at the top?&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000029.ubb&amp;q_id=29"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;13&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Write a routine to draw a circle given a center coordiante (x,y) and a radius (r) without making use of any floating point computations.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;amp;number=4&amp;topic=000031.ubb&amp;amp;q_id=31"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;14&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Implement a TIC-TAC-TOE game assuming Computer as one of the player. Optimize it for fast computer play time and space. Do some analysis on memory and processing requirements .&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000033.ubb&amp;q_id=33"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;15&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;You are given two strings: S1 and S2. Delete from S2 all those characters which occur in S1 also and create a clean S2 with the relevant characters deleted.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;amp;number=4&amp;topic=000035.ubb&amp;amp;q_id=35"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;16&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Write a small lexical analyzer for expressions like "a*b" etc.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000036.ubb&amp;q_id=36"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;17&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Given an array t[100] which contains numbers between 1 and 99. Return the duplicated value. Try both O(n) and O(n-square).&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;amp;number=4&amp;topic=000037.ubb&amp;amp;q_id=37"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;18&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Write efficient code for extracting unique elements from a sorted list of array.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000038.ubb&amp;q_id=38"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;19&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt; Print an integer using only putchar. Try doing it without using extra storage.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;amp;number=4&amp;topic=000040.ubb&amp;amp;q_id=40"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;20&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Write a function that allocates memory for a two-dimensional array of given size(parameter x &amp; y)&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;number=4&amp;topic=000041.ubb&amp;amp;q_id=41"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;21&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;How would you do conditional compilation ?&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000048.ubb&amp;q_id=48"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;22&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Write an algorithm to draw a 3D pie chart ?&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;number=4&amp;topic=000049.ubb&amp;amp;q_id=49"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;23&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Write a funtion that finds repeating characters in a string.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000052.ubb&amp;q_id=52"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;24&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Write a routine to reverse a series of numbers without using an array.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;number=4&amp;topic=000053.ubb&amp;amp;q_id=53"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;25&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt; Write a function to find the nth item from the end of a linked list in a single pass.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000054.ubb&amp;q_id=54"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;26&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Write a function to compute the factorial of a given integer.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;amp;number=4&amp;topic=000055.ubb&amp;amp;q_id=55"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;27&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;Give me an algorithm for telling me the number I didn't give you in a given range of numbers. (Numbers are given at random)&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;topic=000056.ubb&amp;q_id=56"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;28&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt; Write a function that finds the last instance of a character in a string.&lt;br /&gt;&lt;/span&gt;&lt;span class="jeevetextbody"&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.acetheinterview.com/cgi-bin/answers.cgi?action=answers&amp;number=4&amp;amp;amp;topic=000057.ubb&amp;amp;q_id=57"&gt;Answers here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21654981-113853441971968052?l=puzzlingu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://puzzlingu.blogspot.com/feeds/113853441971968052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21654981&amp;postID=113853441971968052' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113853441971968052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113853441971968052'/><link rel='alternate' type='text/html' href='http://puzzlingu.blogspot.com/2006/01/algorithms.html' title='Algorithms...'/><author><name>srividya</name><uri>http://www.blogger.com/profile/02823093035826368711</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21654981.post-113853287448201824</id><published>2006-01-29T03:00:00.000-08:00</published><updated>2006-01-29T03:07:54.483-08:00</updated><title type='text'>Level 4</title><content type='html'>&lt;span class="contentText"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;What is the length of the shortest string that contains all strings of  size 9&lt;br /&gt;with characters ABCDEFGHI (repetitions are allowed)? &lt;br /&gt;Example:  "AABBA" contains all strings of size 2 (AA,AB,BA,BB)&lt;br /&gt;with characters AB.&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Ans: 387420497&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="contentText"&gt;2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;7**7= 823543 (7 power 7).  What is the next power of 7 that ends&lt;br /&gt;with   823543?&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Ans: 5007&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;3&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;An array of size 32767 (2 power 15 - 1) is given. All cells are  initialized&lt;br /&gt;to ZERO. The objective is to set 32766th cell to ONE  following the rules&lt;br /&gt;(array index starts with ZERO) below:&lt;br /&gt;&lt;br /&gt;    1. You can have maximum of 15 ONE's set at any time in the array. &lt;br /&gt;   2. You can flip the Xth cell to ONE or ZERO only when  (X-1)th cell is&lt;br /&gt;set to ONE.&lt;br /&gt;   3. ZERO'th cell can be  flipped without any conditions.&lt;br /&gt;        How many minimum flips are needed to set the 32766th cell to ONE?&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Ans: Not known&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;4&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;An array of size 32762 is given. 0th cell value is 1,   1st cell value is 2, ..... ,&lt;br /&gt;36761th cell value is 36762.   In each iteration the array is split into two&lt;br /&gt;equal halves and   they are merged by taking one element from each half.&lt;br /&gt;Example:   Consider the array of size 4. If the array is 12345678,   in the&lt;br /&gt;first iteration it is split as 1234 and 5678 and merged as   15263748; second&lt;br /&gt;iteration its split again as 1526, 3748 and merged   as 13572468; third&lt;br /&gt;iteration its split as 1357 and 2468 and after   merging it becomes again&lt;br /&gt;12345678. How many minimum iterations are   needed for the array&lt;br /&gt;(of size 32762) to come back to original array?&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Ans: 16380&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21654981-113853287448201824?l=puzzlingu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://puzzlingu.blogspot.com/feeds/113853287448201824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21654981&amp;postID=113853287448201824' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113853287448201824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113853287448201824'/><link rel='alternate' type='text/html' href='http://puzzlingu.blogspot.com/2006/01/level-4.html' title='Level 4'/><author><name>srividya</name><uri>http://www.blogger.com/profile/02823093035826368711</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21654981.post-113853234330221483</id><published>2006-01-29T02:50:00.000-08:00</published><updated>2006-01-29T02:59:03.303-08:00</updated><title type='text'>Level 3</title><content type='html'>&lt;span class="contentText"&gt;1&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="contentText"&gt;9 people hold 5119 shares in a company. In every decision voting, any&lt;br /&gt;subset or all of the 9 people can participate.If a person participates in&lt;br /&gt;voting, he/she can either vote FOR or AGAINST the decision.&lt;br /&gt;The number of votes is equal to the number of shares a person holds.&lt;br /&gt;For every decision there shouldn't be a TIE between the two choices.&lt;br /&gt;In a decision, a group with smaller number of people should never&lt;br /&gt;win over higher number of people. What is the least number of&lt;br /&gt;shares a person can hold?&lt;br /&gt;Ans: 1 (not sure)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="contentText"&gt;2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;An array of size 4 is given which can contain only ZERO or ONE values.&lt;br /&gt;Objective is to make all  values to ZERO's or ONE's.   Initial values can be&lt;br /&gt;any thing. At each iteration you   can toggle only one or two cells  of the&lt;br /&gt;array. After you toggle,   the array is circular shifted by the system.&lt;br /&gt;The circular shift can happen by random    length (it can be circular shifted&lt;br /&gt;by one cell, two cells, three cells or four   cells). You can't maintain the&lt;br /&gt;state  of your previous operation, so you don't know which cells   you&lt;br /&gt;touched in the previous iteration.  How many maximum iterations are   &lt;br /&gt;needed to make the array into all ZERO's or ONE's given any initial values?&lt;/span&gt;&lt;br /&gt;Ans: 1 (not sure)&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;3&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;A 5*5 array is initialized to all 1s. Each cell can be either 0 or 1. When you&lt;br /&gt;flip a cell (m,n) (say from 1 to 0) all its four neighbors(left, right, up and&lt;br /&gt;down) flip. You need to change the array into all ZEROs by flipping the&lt;br /&gt;cells. How many minimum flips are required?&lt;/span&gt;&lt;br /&gt;Ans: not known&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;4&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;Consider a string "abc" and a stack with push and pop      operations. Given&lt;br /&gt;any permutation of "abc", we can process the      characters in that order and&lt;br /&gt;try to output "abc" using the stack.     For example, if the string "cab" is given,&lt;br /&gt;"abc" can be generated  using the following sequence of operations -&lt;br /&gt;1) push 'c' 2)  output 'a'    3) output 'b' 4) pop 'c'. However, given a string&lt;br /&gt;"bca", it is not     possible to generate "abc".        Now, consider the string&lt;br /&gt;"macbeth".    How many permutations of this string can generate       "macbeth"&lt;br /&gt;using one stack and a sequence of push and pop      instructions?&lt;/span&gt;&lt;br /&gt;Ans: 429&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21654981-113853234330221483?l=puzzlingu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://puzzlingu.blogspot.com/feeds/113853234330221483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21654981&amp;postID=113853234330221483' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113853234330221483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113853234330221483'/><link rel='alternate' type='text/html' href='http://puzzlingu.blogspot.com/2006/01/level-3.html' title='Level 3'/><author><name>srividya</name><uri>http://www.blogger.com/profile/02823093035826368711</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21654981.post-113852486709956434</id><published>2006-01-29T00:44:00.000-08:00</published><updated>2006-01-29T02:36:10.723-08:00</updated><title type='text'>Level-2</title><content type='html'>&lt;table border="0" cellpadding="0" cellspacing="1"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td align="center" height="25" valign="top"&gt;&lt;span class="contentText"&gt;1&lt;/span&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;span class="contentText"&gt;What is the probability of two people arriving at a restaurant withing 8 minutes&lt;br /&gt;of each other between 1 PM and 5 PM?The answer needs to be rounded to&lt;br /&gt;4 decimal places with no trailing zeroes. (e.g .15 needs to be represented as&lt;br /&gt;0.15, 0.154567 needs to be represented as 0.1546)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255); font-weight: bold;"&gt;Ans: 0.0734&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;&lt;tr&gt;     &lt;td align="center" height="25" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;2&lt;/span&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;&lt;br /&gt;6 people got on a train at its starting point. There are 12 stations on which&lt;br /&gt;they can get off (excluding the starting point. What is the total number of&lt;br /&gt;different ways they can do this considering that no more than 3 people get&lt;br /&gt;off at the same station?&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255); font-weight: bold;"&gt;Ans: 11440&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;&lt;tr&gt;     &lt;td align="center" height="25" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;3&lt;/span&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;&lt;br /&gt;A machine has 64 KB of virtual memory and 1 KB of physical memory.&lt;br /&gt;This machine uses a set-associative page table with a page size of 64&lt;br /&gt;bytes and 4 sets. The low order bits of the virtual page number are used&lt;br /&gt;to decide the set in which a virtual page is placed. The page replacement&lt;br /&gt;algorithm in each set is round-robin: on the first page fault, the first page&lt;br /&gt;in the set is replaced. On the second page fault, the second page in the&lt;br /&gt;set is replaced and so on. The contents of the page table are given in&lt;br /&gt;increasing order of physical page number below, where the virtual page&lt;br /&gt;number is in hex: 0x348, 0x28c, 0x280, 0x164, 0x79, 0x3fd, 0x331,&lt;br /&gt;0x55, 0xaa, 0x6e, 0x2e2, 0x246, 0x3db, 0x3df, 0x193, 0x337.&lt;br /&gt;A program issues the following virtual addresses in hex: 0xb888,&lt;br /&gt;0xda80, 0xe9d0, 0x1dc8, 0xf6c4, 0x2a80, 0x64ec, 0xd590. What are&lt;br /&gt;the final contents of the Page Table?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Ans: 0x348,0x28c,0x280,0x164,0x79,0x3fd,0x331,0x55,0x36a,0xaa,0x356,0x246,0x3a7,0x77,0x3db,0x193&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;&lt;tr&gt;     &lt;td align="center" height="25" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;4&lt;/span&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;&lt;br /&gt;I have a 4 bit number "n" in mind (that is, 0 &lt;= n &lt;= 15). To help you&lt;br /&gt;guess this number, I have answered seven questions below (the least      &lt;br /&gt;significant bit is bit 1 and the most significant bit is bit 4 ):&lt;br /&gt;     &lt;br /&gt;Q1. Is bit 1 equal to 1? Yes&lt;br /&gt;Q2. Is bit 2 equal to 1? Yes&lt;br /&gt;Q3. Is bit 3 equal to 1? No&lt;br /&gt;Q4. Is bit 4 equal to 1? No&lt;br /&gt;Q5. Is the sum of bits 1, 2 and 4 even? No&lt;br /&gt;Q6. Is the sum of bits 1, 3 and 4 even? Yes&lt;br /&gt;Q7. Is the sum of bits 2, 3 and 4 even? No&lt;br /&gt;     &lt;br /&gt;The catch here is that the answer to &lt;b&gt;exactly one&lt;/b&gt; of the seven&lt;br /&gt;questions above is wrong,  the other six are correct.&lt;br /&gt;Which answer is wrong?&lt;br /&gt;(For example, if the answer to Q6 above is wrong, your response&lt;br /&gt;should be 6.)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Ans: 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;&lt;tr&gt;     &lt;td align="center" height="25" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;5&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;&lt;br /&gt;9 0s are placed from 0th cell to 8th cell of an array; 8 1s are placed from&lt;br /&gt;10th cell to end of the array. On the whole, there are 18 cells, so that just&lt;br /&gt;one cell remains unoccupied. 0s only move rightward; 1s move leftward.&lt;br /&gt;Every move is either a move to the next empty cell or a jump over one&lt;br /&gt;cell which has different value. In any case, no two values are allowed&lt;br /&gt;in the same square. The goal is to move 1s into 8 leftmost positions and&lt;br /&gt;the 0s into 9 rightmost positions. How many minimum moves are&lt;br /&gt;needed to achieve this?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Ans: 88&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;&lt;tr&gt;     &lt;td align="center" height="25" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;6&lt;/span&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;&lt;br /&gt;All 7 digit permutations of number 1234567 are sorted and kept&lt;br /&gt;in an array of 5040 elements. (0th element is 1234567, 1st element&lt;br /&gt;is 1234576 and 5039th element is 7654321.)&lt;br /&gt;What is the 1646th element in this array?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Ans: 3265174&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;&lt;tr&gt;     &lt;td align="center" height="25" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;7&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;&lt;br /&gt;A character in an alphabet is represented in 12 bits. How many&lt;br /&gt;characters are there in the alphabet which have at least one&lt;br /&gt;sequence of 3 adjacent 0s?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Ans: 2391&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;&lt;tr&gt;     &lt;td align="center" height="25" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;8&lt;/span&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="contentText"&gt;&lt;br /&gt;Given a 9 X 9 sided square(rows 0 to 8, columns 0 to 8) where&lt;br /&gt;the cell(8,3) contains a RED dot (rest of the cells dont contain the&lt;br /&gt;RED dot). How many squares are present of any size without&lt;br /&gt;having the RED dot in them?&lt;br /&gt;    &lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Ans: 260&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt; &lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21654981-113852486709956434?l=puzzlingu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://puzzlingu.blogspot.com/feeds/113852486709956434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21654981&amp;postID=113852486709956434' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113852486709956434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113852486709956434'/><link rel='alternate' type='text/html' href='http://puzzlingu.blogspot.com/2006/01/level-2.html' title='Level-2'/><author><name>srividya</name><uri>http://www.blogger.com/profile/02823093035826368711</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21654981.post-113852335826708131</id><published>2006-01-29T00:24:00.000-08:00</published><updated>2006-01-29T02:48:45.453-08:00</updated><title type='text'>Level 1</title><content type='html'>&lt;pre  style="color: rgb(51, 0, 51);font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:130%;"&gt;&lt;span style=";font-family:georgia;font-size:85%;"  &gt;1) There are 14 steps. A person is starting from the bottom climbing to the top.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:georgia;font-size:85%;"  &gt;A person can climb, at a time, one, two or three steps.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:georgia;"&gt;&lt;span style="font-size:85%;"&gt;In how many ways can he climb the steps and reach the top?&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;Ans: 3136&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;2) You are given an infinite number of cookie boxes containing either 6, 9&lt;br /&gt;or 140 cookies. You are allowed to use these boxes in any combination so&lt;br /&gt;desired. What is the maximum number of cookies that you cannot give&lt;br /&gt;out using the above boxes?&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;Ans: 283&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;3) A Binary Tree can be fixed given its nodes in Pre-Order and&lt;br /&gt;In-Order sequence. The Pre-Order of a tree is c,g,d,j,i,f,e,a,b,h and In-order&lt;br /&gt;traversal of this tree is i,f,j,d,e,g,c,b,a,h. What will be the Post-Order traversal&lt;br /&gt;of the same binary tree? Each alphabet in the sequence represents one node&lt;br /&gt;of the binary tree. Give the output as a comma separated list&lt;br /&gt;of alphabets(nodes),for eg. a,b,c,d,e,f,g,h,i,j.&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;ANS: f,i,j,e,d,g,b,h,a,c&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;4) Examine the code below. Each second, the function Writer is called 4 times,&lt;br /&gt;following which the function Reader is called 1 times (in the same thread there&lt;br /&gt;is no multithreading involved here). The same cycle repeats every second.&lt;br /&gt;What is the first number to be printed by this program?&lt;br /&gt;&lt;br /&gt;#include &lt;/span&gt;&lt;stdio.h&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;#define BUFFER_SIZE 16&lt;br /&gt;int buffer[BUFFER_SIZE];&lt;br /&gt;&lt;br /&gt;int writeIndex = 0;&lt;br /&gt;int readIndex = 0;&lt;br /&gt;&lt;br /&gt;int IncrementCircular(int start)&lt;br /&gt;{&lt;br /&gt;int sum = start + 1;&lt;br /&gt;return sum &gt;= BUFFER_SIZE ? sum - BUFFER_SIZE : sum;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void Reader()&lt;br /&gt;{&lt;br /&gt;if (readIndex != writeIndex)&lt;br /&gt;{&lt;br /&gt;// Consume buffer[readIndex] here.&lt;br /&gt;readIndex = IncrementCircular(readIndex);&lt;br /&gt;}&lt;br /&gt;// else, buffer is empty.&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void Writer()&lt;br /&gt;{&lt;br /&gt;static int value = 1;&lt;br /&gt;if (IncrementCircular(writeIndex) == readIndex)&lt;br /&gt;{&lt;br /&gt;// The buffer is full - print the value.&lt;br /&gt;fprintf(fpq"%d\n", value);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;buffer[writeIndex] = value;&lt;br /&gt;writeIndex = IncrementCircular(writeIndex);&lt;br /&gt;}&lt;br /&gt;++value;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;ANS: 20&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;5)Tower of Honoi: we are given a tower of N disks, initially stacked in&lt;br /&gt;increasing size on one of three pegs. The objective is to transfer the entire&lt;br /&gt;tower to one of the other pegs, moving only one disk at a time and never a&lt;br /&gt;larger one onto a smaller. In this variation of tower of honoi, peg two&lt;br /&gt;contains 1-4 disks and peg one contains 5-9 disks. How many minimum&lt;br /&gt;moves are needed to move all the disks to the third peg moving only one&lt;br /&gt;disk at a time and never a larger one onto a smaller?&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;ANS: 542&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;6)Multiply 13332 represented in base -7 with 15117 represented in&lt;br /&gt;base -8 and represent the output in base -9.&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;ANS:50554230&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;7)An array contains 8 occurences of 0s, 4 occurences of 1s and 7 occurences&lt;br /&gt;of 2s in any order. The array is to be sorted using only swap operations.&lt;br /&gt;What is the minimum number of swaps needed in the worst case to sort&lt;br /&gt;the array?&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;ANS: 20&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;8)An LCD(Liquid Crystal Display) can represent 0 to 9 digits.&lt;br /&gt;If you turn the LCD upside-down, some of the numbers still remain valid&lt;br /&gt;numbers for example 16 becomes 91. If you index all positive numbers(&gt;0)&lt;br /&gt;that can produce valid numbers when you upside down the display&lt;br /&gt;(like 1st one is 1, 2nd one is 2, 3rd one 5... 7th one is 10), what is the&lt;br /&gt;1254th number in this series?&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;ANS: 5661&lt;/span&gt;&lt;br /&gt;&lt;/stdio.h&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21654981-113852335826708131?l=puzzlingu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://puzzlingu.blogspot.com/feeds/113852335826708131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21654981&amp;postID=113852335826708131' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113852335826708131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21654981/posts/default/113852335826708131'/><link rel='alternate' type='text/html' href='http://puzzlingu.blogspot.com/2006/01/level-1.html' title='Level 1'/><author><name>srividya</name><uri>http://www.blogger.com/profile/02823093035826368711</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
