Data structure to be used for implementing online booking system [closed] - data-structures

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
It was asked by a interviewer.
The target is to Design a train tickets Reservation system. If the train go through 5 stations(e.g. A,B,C,D,E). We could sell tickets from A-E or A-B, if a ticket from A-B is sold, we could go on sell tickets between B-E.
The question is which data structure is suitable to present the seats? It should show which section is available for sale.
Thanks for help!

To be quite honest, "that interviewer's question, at least as it has been presented by you, makes very little sense." (Maybe the interviewer provided more details at-the-time that you have since forgotten.)
But the basic idea should be: "what is the fact that you need to represent?" Well, in this case, the "fact" is that user_X, on this_train, has a ticket to go from_station A, to_station B ... where "A" and "B" are enumerations such that you can easily determine when two stations "overlap."
From this, you can then proceed to define the various "bright-line rules" that the reservation system must be able to apply. For instance: "how many existing reservations overlap a certain range-of-stops?" (This will allow you to determine if the seat-capacity of the train would be exceeded.)

Related

What's a good data structure to store and work with a thesaurus? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I've been working for a few years on an English-language thesaurus project, which combines a few sources (e.g. WordNet, Wiktionary Thesaurus, Moby Thesaurus, Word2vec) to make a large thesaurus. Currently I have the data defined as a list of lists. And each link has a score (higher = stronger), so "hotel" and "inn" might have a score of 2.0; but "hotel" and "fleabag" has a score of 0.2. High scores are near synonyms, low scores are more distant associations. I've been able to use Dijkstra and A* to find links between words (so-called "synonym chains").
Is there a type of graph database and/or analysis tools which is ideally suited for this sort of data? Word relationship strengths are often asymmetric. For example "Hoover Dam" links to "Herbert Hoover" more strongly than "Herbert Hoover" links back to "Hoover Dam". I'm interested in better ways to find the links between words, find unrelated words, measure word similarity.
I'd appreciate any new pointers/direction.
Interesting question. Not sure about the best data structure, but for processing, you can look at shell neighbors within this package: https://grispy.readthedocs.io/en/latest/api.html

How to classify string into a person's name or company's name or none of these? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Let's say, I have string say 'John Doe' and I want to determine whether this string is a name of a person, name of a company or none of these.
Every minute more and more strings are coming into my system and the system needs to classify into one of these 3 categories.
You would need a dictionary of strings in different categories to compare them against.
Without a dictionary you would need some kind of AI/machine learning that could do this automatically, but that is far beyond the scope of the kind of answer you'll get here.
NLTK provides the corpora of the most common English words (nltk.corpus.words.words('en')) and most common English names nltk.corpus.names.words())
Use gensim word2vec, it's a library provided by google where it have vectors and relationship for all the words.
Now when you enter the text to the system, first you'll get vector for your word.
On the top of this you can apply any classification algo to categorize your task.
Hope this help!

Searching through an list [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I'm reading about AI and in the notes it is mentioned
A lookup table in chess would have roughly 35^100 entries.
But what does this mean? Is there any way we could find out how long it would take the computer to search through and find it's entry? Would we assume thereis some order or that there is no order?
The number of atoms in the known universe is estimated to be around 10^80 which is much less than 35^100. With current technology, at least a few thousand atoms are required to store a single bit. I assume that each entry of your table would have multiple bits. You would need some really advanced technology to implement the memory of your computer.
So the answer is: With current technology it is not a matter of time, it is simply impossible.

Alternative descriptions for 'refactoring' that make a manager happy? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
My boss does not ever want to hear the word refactoring again, because whenever he asks a person what he is working, they reply "I'm refactoring!"
I need to find alternative descriptions for refactoring that can make a manager happy. Thesaurus.com does not find anything for refactoring, any ideas what I should tell him when he asks what I am doing?
You don't even need to mention them that word. Just tell them you are working on the task at hand. As refactoring is normally an integral part of the development cycle (test - code- refactor), this is indeed (a part of the) truth.
If (s)he insists on getting more details, you can tell you are "finalizing the solution", "ensuring long term maintainability of the code", or - if (s)he fancies management speak - "leveraging the synergies within the product architecture" :-)
say that you are optimizing coherency

Does Ball park estimate ever help [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
In our projects we are often asked to give ball park estimates for activities. My question does it really help in taking decisions based on the estimate.
Yes as pointed out above.
No if the client later says "Oh, but that's much more than the X days you initially estimated"
You need to be careful in explaining and agreeing on what "ballpark" really means
Yes .. it can help to give rough estimates to the client but later on these estimates can show upto +/- 50% variation.
But it can help to gauge the size of the project and roughly manday efforts
Something to add to the existing responses.
Pros:
Helpful for a teamleader to assess
the number of resources needed for a
set of activities.
Useful to assess
whether a task would fit in a pre
defined timeline
Cons:
Very rough estimate
Need to be very careful while sharing with the customer.
I often use these ballpark estimates to give a quick price quote to a client, when based on models such as WMFP or COCOMO-II they can also help me make an unbiased assessment.

Resources