zeroByzero
BAN USER
6 Answers this is my general doubt not a...
this is my general doubt not a particular question .
- zeroByzero January 06, 2013
1. how should we respond if we have no clue about the problem asked ..?
2. and are we asked to code all problems they ask.., like if problem involve complex data structure if you know the approach to the problem ,do they also ask for their code ,.?| Flag | PURGE
@ amit nice solution , can you suggest how to go for all 256 characters . i am thinking to use array of 8 nos, but couldnt think of algo, please explain if you know .
- zeroByzero January 13, 2013please explain your logic little more.
- zeroByzero January 13, 2013duplicates from whole string.
- zeroByzero January 13, 2013for this kind of problems first identify the problem entities:
---- Problem State
1. in a restaurent there are different tables (say x in no) of different capacities .
2 .we can book a table of capacity n for m people (m<=n);
3. a table can be booked only if there is suitable time difference between two bookings
4. booking can be done only for particular no of hours for which restaurent opens .
--- what will be input from external interface
int CheckTableAvailability(int NumPeople, time_t TimeOfBooking, int *tableNumber, time_t *alternativeTime)
{
if(isTable_Available(NumPeople,TimeOfBooking))
{
*tableNUmber=isTable_Available(NumPeople,TimeOfBooking);
return 1;
}
if(alternate_time(NumPeople,TimeOfBooking))
{
alternatetime=alternate_time(NumPeople,TimeOfBooking)
return 2;
}
else
{
cout<<"no Booking possible";
return 0;
}
}
- This function will tell whether the booking is possible or not. If possible on the input time it will
return 1 and file the tableNumber. If not on the input time, but at some time near to that, it will
return 2 with the alternativeTime and TableNumber that can be booked. If not at all possible then it will return 0.
bookTable(contactDetails, tableNumber, time_t TimeOfBooking)
Extra functionality
for CheckTableAvailability , it can also return an array of tableNumber possible for booking. Like some restaurants have different sections (smoking zone, pool side, garden side etc) which will give the customer a choice to make.
Class: Table
{
int TableId;
int SeatingCapacity;
string speciality;
}
Class Booking
{
int bookingId;
int TableId;
time_t startTime;
customerDetails;
}
Class: BookedTables
{
HashTable bookings ( key: timeslot, value: int booked[NumTables] );
// int array will contain whether the table is booked or not for this time slot. A value of 0 means not booked. A value other than 0 represents a booking id
}
in overloading functions with same name are used but they have different parameters type or no. for better understanding u may follow this link geeksforgeeks.org/function-overloading-in-c/
while overriding is concept in inheritence ,function with same name and parameters are present both in base and child class .
couldnt get you, looks like you are using suffix tree..please elaborate .
- zeroByzero January 11, 2013please elaborate how to go with tries, here we are given stream of characters not array of characters.
- zeroByzero January 11, 2013perfect
- zeroByzero January 10, 2013you have to shift only till n/2, since maximum length of repeated substring can be n/2.
- zeroByzero January 10, 2013i have got one possible solution . using linked list and hash-map.
1. for 1st string insert 1st and last character into the string and also in hash map.
2. for subsequent strings check hash values for its 1st character in hash table ,
IF hash for this character exist then insert last character of this string to next of the hash address we have got from hash map.
ELSE create new linked list for first and last character of this string and insert it into hash map also .
3. keep on processing all the string , when we are done , we can traverse all the linked list and apply cycle detection algorithm , this way we can find all the strings forming cycle.
please suggest modifications
we can use n-way merge using minimum heap of size(min of no of row and coloumn ) ,
it is example of standard n-way merge , here we are given n-sorted rows in 2-D matrx .
algorithm would work like :
1. pick up 1st elements from all the rows and insert them into Min-heap.
2. top of element contain minimum element , pop it and insert element from the array
whose element was poped .
3. while making insertion check the last popped value , if it is same then do not push this into heap, simply increment its pointer in the repected row, this will take care of duplicates too.
3.keep doing this operation till no element is left in any of the row and heap .
Complexity: if matrix is of size m*n
O(log m)*m*n
@ grace you have made a valid point .
for keeping check of duplicate, i.e, item is already there we should also keep hash map of 10 items and before insertion we should check if the item is already there, if it is already there then it should be moved in front of queue by deleting it fom its position (USE DLL)
thanx man..
i still have doubt, if for any problems we do not know their code, like if i am using suffix tree as a part of the algorithm , i am assuming SUFFIX tree can we constructed in O(n) but i do not know how to code that, in that case what should we do..?
we can keep a queue of last 10 item visited for every user . whenever a new item will be added last items should be deleted such that only 10 items are kept in FIFO fashion.
- zeroByzero January 03, 2013i am sorry , i dont have full question . i have got it from some senior ..this was something similar
- zeroByzero January 02, 2013yeah correct, but a little improvement using memozation will improve this code..
int no_of_BST(int n)
{
int arr[n];
arr[0]=arr[1]=1;
for(int i=2;i<=n;i++)
arr[i]=0;
for(int i=2;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
arr[i]+=arr[j-1]*arr[i-j];
}
}
return arr[n];
}
@ xiaolong ,i doubts its validity please explain your logic in details
- zeroByzero December 29, 2012looking at the node structure , question is not clear..please check once again .
- zeroByzero December 27, 2012this is greedy approach wouldnt it fails for some of the cases ....wouldn't it fails for some of the cases ?
- zeroByzero December 18, 2012why are we using doubly linked list..?
- zeroByzero December 17, 2012hey annonymous couldnt understand clearly..please elaborate your logic..why doubly linked list and how delete operation in O(1) ?
- zeroByzero December 16, 2012we can use minimum heap of size n with 1st element from every array.
1. pop the minimum element from the heap and push the element from the arrya which contains minimum element and heapify again....this process continues till no element remain in any array .
another approach can be to sort the nos nd check...(o(nlogn) not efficient .
- zeroByzero October 22, 20127k is right answer
- zeroByzero September 02, 2012store inorder traversal of tree in an array and sort it ,and again do inorder traversal and insert value from sorted array to tree .
the method posted by PKS may not work.
this can be done by trversing the linked list and check if child is not null then modify the pointers in list.
[nod1]<>[node2]<>[--]..............[--]
| | | |
list1 l ist 2 list 3.............list4
for each node just do following
node1->next=list1(head);
list1(head)->previous=node1;
list1(tails)->next=node2;
node2->previous=list1(tails);
this is code
cur=start;
while(cur=>next!=NULL)
{
temp=cur->next;
temp2=cur->child;
if(temp2) //if child exist
{
temp3=temp2;
while(temp3->next!=NULL)
temp3=temp->next;
//node u have found end of child list just change pointers
cur->next=temp2;
temp2->previous=cur;
temp3->next=temp1;
temp1->previous;
//
now increment current pointer for next node
cur=temp1;
}
else
cur=cur->next; //if child was NULL just go ahead
}
}
for any clarification or bug please comment
- zeroByzero August 20, 2012i could not understand the logic, please explain little bit..
- zeroByzero August 18, 2012nice logic..
- zeroByzero August 17, 2012hey thanx for pointing out about bug to delete last element, but its not dead loop as in both if and else current=current is there, have a look again
- zeroByzero August 17, 2012gives starting point , but of lot of improvement posible as suggested by ranechabria..
- zeroByzero August 16, 2012u should post suggestion in comment box instead of new reply.
ur comment doesnt make sense when it floats above original post.
hey man review your question nd post again lot of typos.
- zeroByzero August 16, 2012this is simple algo ,traverse the list ,delete the node whenever value matches.
start node is special case which is handled saperatly .
void delete(int x,node *start)
{
node *current=start;
while(current)
{
if(current->value==x) //if we have to delete start node
{
if(current==start)
{
node *temp=start;
current=current->next;
start=current;
delete(node);
}
else
{
node *temp=current->next;
current->value=current->next->value;
current->next=current->next->next;
current=current->next;
delete(temp);
}
}
}
that looks to be only correct answer out of all given above.
- zeroByzero July 24, 2012that looks to be only correct answer out of all given above.
- zeroByzero July 24, 2012for ny doubt learn short circuit property of AND ,OR operator.
- zeroByzero July 21, 20122,3,4 and other too.
- zeroByzero July 21, 2012since we have to enclose all N points, so we can always choose any 5 points in 3-D space (forming prims ) which will enclose all points.
correct me if i am wrong.
to me this is ambiguos.
is it o(5*n) or 5*O(n) ?
@ ali baba i think you want to do inorder traversal for getting sorted sequences , preorder traversal is not going to give sorted sequence.
- zeroByzero July 09, 2012
RepNitanaJulliana, Analyst at A9
Hello, I am Nitana and I am working as a project manager in the Softage company. I am very honest ...
Replelarolen76, Android test engineer at Alliance Global Servies
As a Public finance economist I am working at Liberal company . Here I will take a leadership role in the ...
RepLeenFawn, Analyst at A9
I have experience in managing all facets of front office administration, including handling multi-line phone systems, managing schedules, and maintaining ...
Repkristenjjimenezk, Analyst at ADP
We Statistical assistants establish and check numerical facts in many different areas of business, government, and industry. Right now I ...
RepAtiDavis, Analyst at 8x8
I am a skilled construction worker with 3+ years of experience erecting structures according to blueprints and safely utilizing power ...
Repcandacebdemars876, Android Engineer at A9
Hello, I am the Skills Training Coordinator. A skills training coordinator works with human resources and management to identify training ...
RepHayleyGuez, Malwarebytes customer service at CDK Global
I am Hayley , a freelance artist with 7 years of experience in creating impressionist works. My most recent work was ...
RepShayneRies, Android Engineer at ASAPInfosystemsPvtLtd
I am Shayne , working as a Playwright at Woilds , where I write scripts for theatrical productions. Works with more experienced ...
RepCallaRita, techsupport at Knowledge Systems
Hi, I am an Administrative person . It is to develop and sustain an early childhood organisation. I was a teacher ...
RepMistySangra, Developer Program Engineer at Alliance Global Servies
I am Misty , working as a Database Administrator with 4+ years of experience installing, maintaining, and upgrading various servers and ...
RepKelseyOliver, Security Analyst at Accenture
Kelsey , a Storyboard Artist with demonstrated experience in developing visual templates, storyboards, and sketches. The Award winner (2020) for storyboard ...
RepAlizaMaurice, Applications Developer at Absolute Softech Ltd
Aliza, a photojournalist with six years of experience capturing powerful images that tell stories. Have connections with a Vashikaran Specialist ...
RepDaisyDiaz, abc at ADP
I am enthusiastic professional writer with years of experience in writing articles for magazines and newspaper, very dependable and has ...
RepJesseCarlson, Cloud Support Associate at Alfa Chemaical Laboratory
Jesse , a video producer with 4 years of experience in running production processes from start to finish. Excellent at client ...
Repwilsontrent895, Android Engineer at Accenture
My name is WilsonTrent . I am working at A.J. August Fashion Wear as a Physician . Here I am helping ...
RepLoriEver, Applications Developer at ASAPInfosystemsPvtLtd
LoriEver a Rancher working at William Wanamaker & Sons. It's been almost 6-10 years that he has been working this ...
Repchrishwalsh369@gmail.com, Android Engineer at ABC TECH SUPPORT
A computer operator is a role in IT that oversees the running of a computer system.Apart from this, today ...
RepJohnHentz, Animator at Abs india pvt. ltd.
JohnHentz is a Responsible Financial planner working at Plan Smart Partner . i Analyze clients' financial statuses income, expenses and liabilities ...
RepIsabellaRoy, Android Engineer at 8x8
I have excellent reporting and interviewing skills and award-writing techniques. I compose a variety of stories for print news and ...
RepNiaNorna, Analyst at ADP
I am an established career journalist with 15 years of writing and copy editing experience in the newsroom. Seeking to ...
Repandreemsims8765, Accountant at 247quickbookshelp
AndreeSims and I am a Clinical social worker.And nowadays I am doing new research like dua to make someone ...
Repjeannetucker768, Analyst at 247quickbookshelp
Hello I am a computer programmer. I have completed all my studies from New York. Currently I am working in ...
RepElaKim, Accountant at A9
Highly efficient and diligent administrative office professional with seven years of experience in management. Capable leader with excellent skills in ...
Repkentyoung319, Applications Developer at ABC TECH SUPPORT
I am KentYoung . I am working as an Orthotics technician at The Wiz . As an orthotic technician,I manufacture orthotic ...
RepManilaRoche, Animator at Abs india pvt. ltd.
Manila , an extensive executive assistant with experience of 4 years in the field of administrative functions, managing the office of ...
Repjanetjgonzales87, Android Engineer at 247quickbookshelp
Hello I am an internet developer. And I am very much sorry to travel and read some interesting books. Right ...
RepValerieRodri, Associate at Apache Design
I am a Medical equipment repairer in the Morehouse lab at the University of Wichita. I enjoy working with high-technology ...
RepEstaaMoore, Accountant at A9
I am working as a cashier. I quickly and accurately counted drawers at the start and end of each shitt ...
Repjohnsantana9ytt9, Backend Developer at Accolite software
I am working as a Support service manager at Pro Star Garden Management . I had a different experience while working ...
RepWandaScales, Applications Developer at Aspire Systems
I am a Medical writer in the Just For Feet company . I enjoy spells for making someone obsessed with you ...
Repgladysloweg, Brokerage clerk at Bell Markets
I am Gladys from Defiance city . I am working as a Brokerage clerk with tasks associated with securities such as ...
Rephuslafenena, Backend Developer at Absolute Softech Ltd
I am working as a Teletype operator at Midwest TV & Appliance . It's been almost ten years since I've ...
RepJaninaGilden, Java Experienced at Boeing
I am Janina , a Registered Nurse with 3 years experience providing healthcare to a variety of patients in different institutions ...
RepAmaraPerez, Android Engineer at Allegient
I am an outgoing and motivated flight attendant with a strong customer-oriented approach and excellent communication skills.I am always ...
RepKayraKing, abc at A9
I am an expert aircraft maintenance engineer with a high degree of technical knowledge and manual dexterity. In my spare ...
Repruchimosha, Analyst at Absolute Softech Ltd
My name is MaryDuncan . I am working at Crandall's Fine Furniture as a Probation officer . Here I am dealing ...
Repmarksloan761, Backend Developer at Apache Design
As a Meeting manager at Red Bears Tavern here I am working for approximately ten years . In my daily life ...
Repdodramee56, Associate at Absolute Softech Ltd
As a Lift truck operator at Fayva for almost ten years I am working here . Here I met different people ...
RepAngelinaJolly, Member Technical Staff at Bankbazaar
Angelina , a Trustworthy Head Housekeeper with extensive experience in leading a large housekeeping team, hiring and training new staff and ...
RepNancy , a Homemaker manages the household of the various families. I love to explore astrology so I recently took help ...
RepJenniaLopez, Associate at Absolute Softech Ltd
Jennia , a hard-working Packer with a strong determination to finish all assignments in a timely manner. Replaces , operates and maintains ...
Repminniermontano, Android test engineer at 8x8
Hello my name is Minnie and i live in california. And I'm working as a paymaster at Tech Hifi ...
RepEvaSanchez, Animator at Abs india pvt. ltd.
Eva , Manufacturing Worker with 3+ years of experience working in Dynatronics . Went for traveling around the world and gets to ...
RepSammyTurner, HR Executive freshers at Abs india pvt. ltd.
Sammy , an experienced mortuary service provider performed a variety of tasks involved in holding appropriate and solemn rites during funeral ...
RepNancyCramer, Financial Software Developer at Abs india pvt. ltd.
Nancy , an administrative assistant at Libera Inc. to leverage organizational and research skills to support internal and external prayer to ...
RepAileen Kate, HR Executive Trainee at Bankbazaar
Aileen , a game designer with 4+ years of experience in a creative yet deadline-driven environment. Eager to join The Rock ...
Repdennisrichar76, Accountant
I am a resourceful and seasoned Mechanical drafter with a strong customer service and industries. I have a strong knowledge ...
RepSerenaWilliams, Android test engineer at ASAPInfosystemsPvtLtd
Serena , a Building Consultant engages myself in ongoing communication with clients until the project is completed and collects necessary data ...
RepGarzaHodge, Backend Developer at Apache Design
I am Garza, and I work in many different research, education, and health care settings with varying roles, levels of ...
RepCindybilly, Animator at Absolute Softech Ltd
Cindybilly, an Addictions nurse with the experience of 10 years . A substance abuse nurse provides direct patient care to individuals ...
RepElizabethMaxim, Android test engineer at AMD
A financial economist is responsible for the production and distribution of goods and services. We are also responsible for collecting ...
RepRomiTerry, Member Technical Staff at Cleartrip.com
Romi , a Dynamic Property Manager highly regarded for increasing and maintaining a high level of occupancy adhering to all regulations ...
Repericsumm059, Backend Developer at ASU
My name is EricSummey . I am working as a Sound engineering technician at Foreman & Clark . as a sound technician it ...
RepKaiDolern, abc at 8x8
I am knowledgeable and agile legal assistant offering varied experience working as office assistant in a lawyer’s office and ...
Repcheryljnewsome, Android Engineer at ABC TECH SUPPORT
Hello, my name is Chery and I am a Graphic designer. We are Graphic Designers create visual concepts to communicate ...
RepLucindaBriella, Accountant at Clean Power Research
Lucinda, I conduct the admissions process and promote school to prospective students and their guardians. I need a spell caster ...
RepMairaSmith, Integration Software Engineer at Absolute Softech Ltd
MairaSmith , an Quality Control Assistant with a record of success in developing and implementing new quality control policies and procedures ...
RepAtiLee, abc at A9
Hard-working and dependable construction site supervisor with 2 years of success in the industry.Exceptional leadership ability, helping me keep ...
RepPurserCaudle, Network Engineer at AppPerfect
Hi I am Purser, a scientific writer who is a journalist who researches and reports on news and trends in ...
RepNorinaKen, iOS Developer at ASU
Norina, a certified ENP and Emergency Medical Dispatcher with 7 + years of work experience got the opportunity to join the ...
perfect.
- zeroByzero January 13, 2013