SlideShare a Scribd company logo
ANALYSIS AND DESIGN OF ALGORITHMS (UCS 501) PROJECT REPORT
Souvenir's Booth
Using Auto Complete
Abhinav Garg(101303004)
Akshit Arora(101303012)
Chahak Gupta(101303041)
1/12/2015
Submitted To-
Ms. Tarunpreet Bhatia
SOUVENIR’S BOOTH USING AUTO COMPLETE 1
Acknowledgement__________________________________________________________________
We take this opportunity to express my profound gratitude and deep regards to Ms. Tarunpreet
Bhatia for her cordial support, valuable information and guidance, which helped us in
completing this task through various stages while I did face many problem regarding my project
"Souvenir's Booth". She explained the concepts of algorithmic techniques in an illustrious
manner along with providing the necessary guidance through links. This work simply would not
have reached up to such extent without her rational guidance.
Lastly, I thank almighty, my family members and friends for their constant encouragement
without which this assignment would not be possible.
SOUVENIR’S BOOTH USING AUTO COMPLETE 2
INDEX
Sr. No. Title Page Number
1. Abstract 3
2. Introduction 4
3. Objective 5
4. Literature Review 6
5. Algorithmic Techniques Used 6
6. Code 7
7. Schema of Database 10
8. Asymptotic Analysis 11
9. Working Examples 12
11. Conclusion 14
12. Contribution to Society 14
13. References 16
SOUVENIR’S BOOTH USING AUTO COMPLETE 3
Abstract_______________________________________________________________________________
Auto Complete is the most important feature and essential tool when it comes to accessing web
search engines such as Google, Yahoo, and YouTube etc. Although it is intensively used on
internet. Auto-complete features in many offline activities as well. Finest example can be smart
phones. Not only smart phones provide most accurate words but they also predict the words
based on the priorities of the users like previous search history. Form the utilities of this features
in wide application made us to analyze this feature and implement this feature in most efficient
way possible. We implemented auto complete using Trie and analysed the time complexity of
this algorithm.
SOUVENIR’S BOOTH USING AUTO COMPLETE 4
Introduction__________________________________________________________________________
Over the previous couple of years, auto-complete has exploded up all over the web. Facebook,
YouTube, Google, Bing, MSDN, LinkedIn and lots of new websites all try to complete your
phrase as soon as you start typing.
Autocomplete speeds up human-computer interactions when it correctly predicts words being
typed. It works best in domains with a limited number of possible words (such as in command),
when some words are much more common (such as when addressing an e-mail), or writing
structured and predictable text (as in source code editors).
Many autocomplete algorithms learn new words after the user has written them a few times, and
can suggest alternatives based on the learned habits of the individual user done by using machine
learning.
Here, we implement auto complete in a game. The player gets an ordered set of alphabets called
POX. The player needs to use those starting alphabets and make a word. Any word in the
English language starting with POX may or may not exist. If there doesn't exist any such word
then he has to use the maximum possible string from POX starting from its first letter. If he is
not able to make a word with POX but such a word exists in the English language then he is
awarded zero points. If he is able to make any such word then he'll be given points according to
the letters in the word. Now Sukriti wants his friend Abhinav who is a programmer to make a
program that helps him find the possible words so that she can choose from them.
We use a dictionary as data store for storing the words. When we type few letters of a word, we
can do a regular expression match each time through the dictionary text file and print the words
that starting the letters.
Trie data structure is a tree with each node consisting of one letter as data and pointer to the next
node. It uses Finite Deterministic automation. That means, it uses state to state transition.
Words are paths along this tree and the root node has no
characters associated with it.
1. The value of each node is the path or the character
sequence leading up to it.
2. The children at each node are ideally represented using a
hash table mapping the next character to the child nodes.
3. It’s also useful to set a flag at every node to indicate
whether a word/phrase ends there.
The insertion cost has a linear relationship with the string
length. Now let’s define the methods for listing all the
strings which start with a certain prefix. The idea is to
traverse down to the node representing the prefix and
from there do a breadth first search of all the nodes that are descendants of the prefix node. We
check if the node is at a word boundary from the flag we defined earlier and append the node’s
value to the results. A caveat of the recursive approach, is you might run into stack depth
problems when the maximum length of a string reaches tens of thousands of characters.
SOUVENIR’S BOOTH USING AUTO COMPLETE 5
Objectives____________________________________________________________________________
1) To optimize auto-completion of the word.
2) To optimize Depth first search by improving the traversal of data structure by special
algorithm and analysis techniques.
3) To Search Word in the Trie.
4) Modify the default Structure of Trie and with certain tweaks improve the overall time
complexity.
5) We substantially increased the number of word in the Trie from 4 to 45000 words and it
worked correctly.
SOUVENIR’S BOOTH USING AUTO COMPLETE 6
Literature Review___________________________________________________________________
There are many algorithms and data structures to index and search strings inside a text, some of
them are included in the standard libraries, but not all of them; the trie data structure is a good
example of one that isn’t.
Let word be a single string and let dictionary be a large set of words. If we have a dictionary, and
we need to know if a single word is inside of the dictionary the tries are a data structure that can
help us. But you may be asking yourself, “Why use tries if set <string> and hash tables can do
the same?” There are two main reasons:
The tries can insert and find strings in O(L) time (where L represent the length of a single word).
This is much faster than set, but is it a bit faster than a hash table.
 The trie is a tree where each vertex represents a single word or a prefix.
 The root represents an empty string (“”), the vertexes that are direct sons of the root
represent prefixes of length 1, the vertexes that are 2 edges of distance from the root
represent prefixes of length 2, the vertexes that are 3 edges of distance from the root
represent prefixes of length 3 and so on. In other words, a vertex that are k edges of distance
of the root have an associated prefix of length k.
 Let v and w be two vertexes of the trie, and assume that v is a direct father of w, then v must
have an associated prefix of w.
The next figure shows a trie with the words “tree”, “trie”, “algo”, “assoc”, “all”, and “also.”
Note that every vertex of the tree does not store entire prefixes or entire words. The idea is that
the program should remember the word that represents each vertex while lower in the tree.
SOUVENIR’S BOOTH USING AUTO COMPLETE 7
Algorithmic Techniques_____________________________________________________________
 For printing all possible words in a trie with given root: Backtracking Traversal (similar
to DFS)
 For searching the prefix in trie: naïve algorithm used
 For insertion of new words in trie: Recursion
Code___________________________________________________________________________________
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
//Global variables (for the purpose of flags) =>
//found: to indicate whether the word is found or not
//len: to indicate user specified length
int found=0,len=-9999;
class node{ //Node class
public:
char info; //the letter corresponding to node is stored here
string Word;
//for storing words (if completed) till that node
class node* ptrs[256];
//to hold the pointers to 256 next possible letters (ASCII)
node(){
//node class constructor
for(int i=0;i<256;i++){
ptrs[i]=NULL;
}
info=NULL;
Word="";
}
};
void insertword(string word,int pos,class node * root){
//function to insert word
if(word.length()==pos){
//if last position is reached
root->Word=word;
//Put the final word into node
return;
}
SOUVENIR’S BOOTH USING AUTO COMPLETE 8
if( root-> ptrs[word[pos]]==NULL ){
//if next letter is not found
node *newnode;
//create new node
newnode= new node;
newnode->info=word[pos];
//with info = letter to store
root->ptrs[word[pos]]=newnode;
//pointer from current letter to next letter's node
insertword(word,pos+1,root->ptrs[word[pos]]);
//call insert word finction again with next position
}
else
insertword(word,pos+1,root->ptrs[word[pos]]);
//if next letter to add already exists
}
//call insert word directly
void printall(class node * root){
//function to print all possible words given root of trie
for(int i=0;i<256;i++)
//for all 256 pointers in the provided root node
if(root->ptrs[i]!=NULL){
//if those pointers are not null
printall(root->ptrs[i]);
//call printall recursively at each one of them
}
//Similar to DFS traversal
//following code will be executed when the recursion starts
backtracking
if(root->Word != "" && (root->Word.length()==len && len!=-9999))
//first user specified length words will be searched
cout<<" -> "<<root->Word<<endl;
//and printed if they exist
else if(root->Word != "" && len==-9999)
//otherwise, all matching words are printed
{
cout<<" -> "<<root->Word<<endl;
found=1;
}
}
void suggest(string key,int pos, class node * root){
//function to print suggested words
SOUVENIR’S BOOTH USING AUTO COMPLETE 9
if(root->ptrs[key[pos]] != NULL){
//if node is the last position of given key
suggest(key,pos+1,root->ptrs[key[pos]]);
//call suggest with next position
}
else{
printall(root);
//when last node, print all words below it
}
}
int main(){
ifstream in("wordlist.txt");
//input file "wordlist.txt"
string word,current="",key;
char ch;
node *root;
//root node of trie defined
root = new node;
while(in){
in>>word;
//file parsed and all words input to trie
insertword(word,0,root);
}
in.close();
//file stream closed
cout<<endl<<"Trie has been created successfully!"<<endl;
//trie created
cout<<"Enter the starting letters of the word : ";
cin>>key;
//input key from user
cout<<"Do you know the length of the word?(y/n)";
//input required word length(if any)
cin>>ch;
sos:
if(ch=='y')
{
cout<<"Enter the lengthn";
cin>>len;
if(len<=0) {
//if user enters incorrect string length
cout<<"Please enter a length greater than 0.n";
goto sos;
}
}
SOUVENIR’S BOOTH USING AUTO COMPLETE 10
cout<<endl<<"Possible suggestions are :"<<endl;
suggest(key,0,root);
//suggest function call
if(found && ch=='y')
{
cout<<"No words of specified length found";
//if no string found
}
return 0;
}
Schema of Databse____________________________________________________________________
It is the file-based database which used to store words for the Trie. Initially we took 1000 words
and inserted them into the Trie. The words in the file can be of same prefix or different prefix.
As we optimized the code we could store up to 45000 words in the Trie.
SOUVENIR’S BOOTH USING AUTO COMPLETE 11
Asymptotic Analysis__________________________________________________________________
Space Complexity
In worst case analysis, the dictionary will consist of words with no common prefix. At every
level, 256 combinations will be possible from each node. So this will result in a lot of memory
usage.
Maximum number of nodes possible at level 1=256
Maximum number of nodes possible at level 2=2562
Maximum number of nodes possible at level 3=2563
Maximum number of nodes possible at level 4=2564
.
.
.
SOUVENIR’S BOOTH USING AUTO COMPLETE 12
Maximum number of nodes possible at level m=256m
Maximum total number of nodes in a trie with m as maximum length of word is:
256+2562
+2563
+2564
+……………. 256m
= (256(256m
+1 – 1) )/( 256-1)
= (256/255) (256m+1
– 1)
= O(256m
)
So trie will have exponential space complexity in worst case complexity.
Time Complexity
The key determines trie depth. Trie will have linear time complexities in all the cases. So it is
considered to be the most efficient algorithm for implementing trie data structure in spite of
large space complexity.
Using trie, we can search / insert the single key in O(M) time. Here, M is maximum string
length.
In this project, we get the search result in O(key_length + ∑(L)), where key_length is input
given by user and ∑(L) is summation of all the string lengths starting with prefix entered by
user.
Working Examples____________________________________________________________________
Figure 1: Output when user doesn't know length.
SOUVENIR’S BOOTH USING AUTO COMPLETE 13
Figure 2: Output when user inputs non-positive length
Figure 3: Output when specified length matches
Figure 4: The dictionary
SOUVENIR’S BOOTH USING AUTO COMPLETE 14
Conclusion__________________________________________________________________________
 Sukriti's problem of finding the desired solution was solved.
 Auto complete was successfully implemented using Trie.
 Suggests words if words of desired length are not available.
 DFS and Trie's implementation was understood.
Contribution to Society_______________________________________________________________
Auto Complete speeds up human-computer interactions when it correctly predicts words being
typed.
It works best in domains with a limited number of possible words (such as in command line
interpreters), when some words are much more common (such as when addressing an e-mail), or
writing structured and predictable text (as in source code editors).
Works for:
1. Web Browsers
2. E-Mail Programs
3. Search Engines
4. Source Code
5. Word Processors
6. Command-Line Interpreters
SOUVENIR’S BOOTH USING AUTO COMPLETE 15
References_____________________________________________________________________________
 http://v1v3kn.tumblr.com/post/18238156967/roll-your-own-autocomplete-solution-
using-tries
 https://www.topcoder.com/community/data-science/data-science-tutorials/using-tries/
 http://igoro.com/archive/efficient-auto-complete-with-a-ternary-search-tree/
 https://en.wikipedia.org/wiki/Autocomplete
 https://en.wikipedia.org/wiki/Trie
 http://www.geeksforgeeks.org/trie-insert-and-search/

More Related Content

What's hot

Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite Automata
Ratnakar Mikkili
 
String matching, naive,
String matching, naive,String matching, naive,
String matching, naive,
Amit Kumar Rathi
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
Abhimanyu Mishra
 
Design and analysis of algorithms
Design and analysis of algorithmsDesign and analysis of algorithms
Design and analysis of algorithms
Dr Geetha Mohan
 
Context free grammars
Context free grammarsContext free grammars
Context free grammars
Ronak Thakkar
 
Intermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignIntermediate code generation in Compiler Design
Intermediate code generation in Compiler Design
Kuppusamy P
 
Graph traversals in Data Structures
Graph traversals in Data StructuresGraph traversals in Data Structures
Graph traversals in Data Structures
Anandhasilambarasan D
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
Mukesh Tekwani
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
FellowBuddy.com
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
Fahim Ferdous
 
MACRO PROCESSOR
MACRO PROCESSORMACRO PROCESSOR
MACRO PROCESSOR
Bhavik Vashi
 
Directed Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocksDirected Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocks
Mohammad Vaseem Akaram
 
Lecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular LanguagesLecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular Languages
Marina Santini
 
Hashing in datastructure
Hashing in datastructureHashing in datastructure
Hashing in datastructure
rajshreemuthiah
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)
Animesh Chaturvedi
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
Protap Mondal
 
Theory of automata and formal language lab manual
Theory of automata and formal language lab manualTheory of automata and formal language lab manual
Theory of automata and formal language lab manual
Nitesh Dubey
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
Dr Shashikant Athawale
 
Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)
Shuvongkor Barman
 
Cs419 lec10 left recursion and left factoring
Cs419 lec10   left recursion and left factoringCs419 lec10   left recursion and left factoring
Cs419 lec10 left recursion and left factoring
Arab Open University and Cairo University
 

What's hot (20)

Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite Automata
 
String matching, naive,
String matching, naive,String matching, naive,
String matching, naive,
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
Design and analysis of algorithms
Design and analysis of algorithmsDesign and analysis of algorithms
Design and analysis of algorithms
 
Context free grammars
Context free grammarsContext free grammars
Context free grammars
 
Intermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignIntermediate code generation in Compiler Design
Intermediate code generation in Compiler Design
 
Graph traversals in Data Structures
Graph traversals in Data StructuresGraph traversals in Data Structures
Graph traversals in Data Structures
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
 
MACRO PROCESSOR
MACRO PROCESSORMACRO PROCESSOR
MACRO PROCESSOR
 
Directed Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocksDirected Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocks
 
Lecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular LanguagesLecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular Languages
 
Hashing in datastructure
Hashing in datastructureHashing in datastructure
Hashing in datastructure
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Theory of automata and formal language lab manual
Theory of automata and formal language lab manualTheory of automata and formal language lab manual
Theory of automata and formal language lab manual
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)
 
Cs419 lec10 left recursion and left factoring
Cs419 lec10   left recursion and left factoringCs419 lec10   left recursion and left factoring
Cs419 lec10 left recursion and left factoring
 

Similar to Souvenir's Booth - Algorithm Design and Analysis Project Project Report

EasyChair-Preprint-7375.pdf
EasyChair-Preprint-7375.pdfEasyChair-Preprint-7375.pdf
EasyChair-Preprint-7375.pdf
NohaGhoweil
 
Advancements in Hindi-English Neural Machine Translation: Leveraging LSTM wit...
Advancements in Hindi-English Neural Machine Translation: Leveraging LSTM wit...Advancements in Hindi-English Neural Machine Translation: Leveraging LSTM wit...
Advancements in Hindi-English Neural Machine Translation: Leveraging LSTM wit...
IRJET Journal
 
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board ExamsC++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
hishamrizvi
 
Static dictionary for pronunciation modeling
Static dictionary for pronunciation modelingStatic dictionary for pronunciation modeling
Static dictionary for pronunciation modeling
eSAT Publishing House
 
Static dictionary for pronunciation modeling
Static dictionary for pronunciation modelingStatic dictionary for pronunciation modeling
Static dictionary for pronunciation modeling
eSAT Journals
 
Suggestion Generation for Specific Erroneous Part in a Sentence using Deep Le...
Suggestion Generation for Specific Erroneous Part in a Sentence using Deep Le...Suggestion Generation for Specific Erroneous Part in a Sentence using Deep Le...
Suggestion Generation for Specific Erroneous Part in a Sentence using Deep Le...
ijtsrd
 
Ijartes v1-i1-002
Ijartes v1-i1-002Ijartes v1-i1-002
Ijartes v1-i1-002
IJARTES
 
A performance of svm with modified lesk approach for word sense disambiguatio...
A performance of svm with modified lesk approach for word sense disambiguatio...A performance of svm with modified lesk approach for word sense disambiguatio...
A performance of svm with modified lesk approach for word sense disambiguatio...
eSAT Journals
 
Ijarcet vol-3-issue-1-9-11
Ijarcet vol-3-issue-1-9-11Ijarcet vol-3-issue-1-9-11
Ijarcet vol-3-issue-1-9-11
Dhabal Sethi
 
A Dialogue System for Telugu, a Resource-Poor Language
A Dialogue System for Telugu, a Resource-Poor LanguageA Dialogue System for Telugu, a Resource-Poor Language
A Dialogue System for Telugu, a Resource-Poor Language
Sravanthi Mullapudi
 
A project on advanced C language
A project on advanced C languageA project on advanced C language
A project on advanced C language
svrohith 9
 
PyCon 2013 - Experiments in data mining, entity disambiguation and how to thi...
PyCon 2013 - Experiments in data mining, entity disambiguation and how to thi...PyCon 2013 - Experiments in data mining, entity disambiguation and how to thi...
PyCon 2013 - Experiments in data mining, entity disambiguation and how to thi...
Ekta Grover
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
Gabe Wilberscheid
 
Understanding Natural Languange with Corpora-based Generation of Dependency G...
Understanding Natural Languange with Corpora-based Generation of Dependency G...Understanding Natural Languange with Corpora-based Generation of Dependency G...
Understanding Natural Languange with Corpora-based Generation of Dependency G...
Edmond Lepedus
 
Ir 03
Ir   03Ir   03
Chatbot_Presentation
Chatbot_PresentationChatbot_Presentation
Chatbot_Presentation
Rohan Chikorde
 
MULTILINGUAL SPEECH TO TEXT CONVERSION USING HUGGING FACE FOR DEAF PEOPLE
MULTILINGUAL SPEECH TO TEXT CONVERSION USING HUGGING FACE FOR DEAF PEOPLEMULTILINGUAL SPEECH TO TEXT CONVERSION USING HUGGING FACE FOR DEAF PEOPLE
MULTILINGUAL SPEECH TO TEXT CONVERSION USING HUGGING FACE FOR DEAF PEOPLE
IRJET Journal
 
I1 geetha3 revathi
I1 geetha3 revathiI1 geetha3 revathi
I1 geetha3 revathi
Jasline Presilda
 
Sales_Prediction_Technique using R Programming
Sales_Prediction_Technique using R ProgrammingSales_Prediction_Technique using R Programming
Sales_Prediction_Technique using R Programming
Nagarjun Kotyada
 
DETECTION OF JARGON WORDS IN A TEXT USING SEMI-SUPERVISED LEARNING
DETECTION OF JARGON WORDS IN A TEXT USING SEMI-SUPERVISED LEARNINGDETECTION OF JARGON WORDS IN A TEXT USING SEMI-SUPERVISED LEARNING
DETECTION OF JARGON WORDS IN A TEXT USING SEMI-SUPERVISED LEARNING
csandit
 

Similar to Souvenir's Booth - Algorithm Design and Analysis Project Project Report (20)

EasyChair-Preprint-7375.pdf
EasyChair-Preprint-7375.pdfEasyChair-Preprint-7375.pdf
EasyChair-Preprint-7375.pdf
 
Advancements in Hindi-English Neural Machine Translation: Leveraging LSTM wit...
Advancements in Hindi-English Neural Machine Translation: Leveraging LSTM wit...Advancements in Hindi-English Neural Machine Translation: Leveraging LSTM wit...
Advancements in Hindi-English Neural Machine Translation: Leveraging LSTM wit...
 
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board ExamsC++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
 
Static dictionary for pronunciation modeling
Static dictionary for pronunciation modelingStatic dictionary for pronunciation modeling
Static dictionary for pronunciation modeling
 
Static dictionary for pronunciation modeling
Static dictionary for pronunciation modelingStatic dictionary for pronunciation modeling
Static dictionary for pronunciation modeling
 
Suggestion Generation for Specific Erroneous Part in a Sentence using Deep Le...
Suggestion Generation for Specific Erroneous Part in a Sentence using Deep Le...Suggestion Generation for Specific Erroneous Part in a Sentence using Deep Le...
Suggestion Generation for Specific Erroneous Part in a Sentence using Deep Le...
 
Ijartes v1-i1-002
Ijartes v1-i1-002Ijartes v1-i1-002
Ijartes v1-i1-002
 
A performance of svm with modified lesk approach for word sense disambiguatio...
A performance of svm with modified lesk approach for word sense disambiguatio...A performance of svm with modified lesk approach for word sense disambiguatio...
A performance of svm with modified lesk approach for word sense disambiguatio...
 
Ijarcet vol-3-issue-1-9-11
Ijarcet vol-3-issue-1-9-11Ijarcet vol-3-issue-1-9-11
Ijarcet vol-3-issue-1-9-11
 
A Dialogue System for Telugu, a Resource-Poor Language
A Dialogue System for Telugu, a Resource-Poor LanguageA Dialogue System for Telugu, a Resource-Poor Language
A Dialogue System for Telugu, a Resource-Poor Language
 
A project on advanced C language
A project on advanced C languageA project on advanced C language
A project on advanced C language
 
PyCon 2013 - Experiments in data mining, entity disambiguation and how to thi...
PyCon 2013 - Experiments in data mining, entity disambiguation and how to thi...PyCon 2013 - Experiments in data mining, entity disambiguation and how to thi...
PyCon 2013 - Experiments in data mining, entity disambiguation and how to thi...
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Understanding Natural Languange with Corpora-based Generation of Dependency G...
Understanding Natural Languange with Corpora-based Generation of Dependency G...Understanding Natural Languange with Corpora-based Generation of Dependency G...
Understanding Natural Languange with Corpora-based Generation of Dependency G...
 
Ir 03
Ir   03Ir   03
Ir 03
 
Chatbot_Presentation
Chatbot_PresentationChatbot_Presentation
Chatbot_Presentation
 
MULTILINGUAL SPEECH TO TEXT CONVERSION USING HUGGING FACE FOR DEAF PEOPLE
MULTILINGUAL SPEECH TO TEXT CONVERSION USING HUGGING FACE FOR DEAF PEOPLEMULTILINGUAL SPEECH TO TEXT CONVERSION USING HUGGING FACE FOR DEAF PEOPLE
MULTILINGUAL SPEECH TO TEXT CONVERSION USING HUGGING FACE FOR DEAF PEOPLE
 
I1 geetha3 revathi
I1 geetha3 revathiI1 geetha3 revathi
I1 geetha3 revathi
 
Sales_Prediction_Technique using R Programming
Sales_Prediction_Technique using R ProgrammingSales_Prediction_Technique using R Programming
Sales_Prediction_Technique using R Programming
 
DETECTION OF JARGON WORDS IN A TEXT USING SEMI-SUPERVISED LEARNING
DETECTION OF JARGON WORDS IN A TEXT USING SEMI-SUPERVISED LEARNINGDETECTION OF JARGON WORDS IN A TEXT USING SEMI-SUPERVISED LEARNING
DETECTION OF JARGON WORDS IN A TEXT USING SEMI-SUPERVISED LEARNING
 

More from Akshit Arora

Kalam innovation award
Kalam innovation awardKalam innovation award
Kalam innovation award
Akshit Arora
 
Cv akshitarora
Cv akshitaroraCv akshitarora
Cv akshitarora
Akshit Arora
 
Capstone Report - Industrial Attachment Program (IAP) Evaluation Portal
Capstone Report - Industrial Attachment Program (IAP) Evaluation PortalCapstone Report - Industrial Attachment Program (IAP) Evaluation Portal
Capstone Report - Industrial Attachment Program (IAP) Evaluation Portal
Akshit Arora
 
Organizational behavior presentation - Origins of Intelligence
Organizational behavior presentation - Origins of IntelligenceOrganizational behavior presentation - Origins of Intelligence
Organizational behavior presentation - Origins of Intelligence
Akshit Arora
 
Application of Management Tools: Total Quality Management Course
Application of Management Tools: Total Quality Management CourseApplication of Management Tools: Total Quality Management Course
Application of Management Tools: Total Quality Management Course
Akshit Arora
 
A multilevel automatic thresholding method based on a genetic algorithm for a...
A multilevel automatic thresholding method based on a genetic algorithm for a...A multilevel automatic thresholding method based on a genetic algorithm for a...
A multilevel automatic thresholding method based on a genetic algorithm for a...
Akshit Arora
 
Industrial Attachment Program (IAP) Report
Industrial Attachment Program (IAP) ReportIndustrial Attachment Program (IAP) Report
Industrial Attachment Program (IAP) Report
Akshit Arora
 
G.D.P. Trends in India
G.D.P. Trends in IndiaG.D.P. Trends in India
G.D.P. Trends in India
Akshit Arora
 
SRS for Ph.D. Student Portal (C.S.E.D., Thapar University)
SRS for Ph.D. Student Portal (C.S.E.D., Thapar University)SRS for Ph.D. Student Portal (C.S.E.D., Thapar University)
SRS for Ph.D. Student Portal (C.S.E.D., Thapar University)
Akshit Arora
 
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPTImage Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
Akshit Arora
 
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...
Akshit Arora
 
Developing Interactive Landslide Simulator
Developing Interactive Landslide SimulatorDeveloping Interactive Landslide Simulator
Developing Interactive Landslide Simulator
Akshit Arora
 
Developing Interactive Landslide Simulator (Poster)
Developing Interactive Landslide Simulator (Poster)Developing Interactive Landslide Simulator (Poster)
Developing Interactive Landslide Simulator (Poster)
Akshit Arora
 
Developing Interactive Landslide Simulator (Report)
Developing Interactive Landslide Simulator (Report)Developing Interactive Landslide Simulator (Report)
Developing Interactive Landslide Simulator (Report)
Akshit Arora
 
Emotional Regulation and Stress Burnout
Emotional Regulation and Stress BurnoutEmotional Regulation and Stress Burnout
Emotional Regulation and Stress Burnout
Akshit Arora
 
Asynchronous processors Poster
Asynchronous processors PosterAsynchronous processors Poster
Asynchronous processors Poster
Akshit Arora
 
Asynchronous Processors - The Clock less Future
Asynchronous Processors - The Clock less FutureAsynchronous Processors - The Clock less Future
Asynchronous Processors - The Clock less Future
Akshit Arora
 

More from Akshit Arora (17)

Kalam innovation award
Kalam innovation awardKalam innovation award
Kalam innovation award
 
Cv akshitarora
Cv akshitaroraCv akshitarora
Cv akshitarora
 
Capstone Report - Industrial Attachment Program (IAP) Evaluation Portal
Capstone Report - Industrial Attachment Program (IAP) Evaluation PortalCapstone Report - Industrial Attachment Program (IAP) Evaluation Portal
Capstone Report - Industrial Attachment Program (IAP) Evaluation Portal
 
Organizational behavior presentation - Origins of Intelligence
Organizational behavior presentation - Origins of IntelligenceOrganizational behavior presentation - Origins of Intelligence
Organizational behavior presentation - Origins of Intelligence
 
Application of Management Tools: Total Quality Management Course
Application of Management Tools: Total Quality Management CourseApplication of Management Tools: Total Quality Management Course
Application of Management Tools: Total Quality Management Course
 
A multilevel automatic thresholding method based on a genetic algorithm for a...
A multilevel automatic thresholding method based on a genetic algorithm for a...A multilevel automatic thresholding method based on a genetic algorithm for a...
A multilevel automatic thresholding method based on a genetic algorithm for a...
 
Industrial Attachment Program (IAP) Report
Industrial Attachment Program (IAP) ReportIndustrial Attachment Program (IAP) Report
Industrial Attachment Program (IAP) Report
 
G.D.P. Trends in India
G.D.P. Trends in IndiaG.D.P. Trends in India
G.D.P. Trends in India
 
SRS for Ph.D. Student Portal (C.S.E.D., Thapar University)
SRS for Ph.D. Student Portal (C.S.E.D., Thapar University)SRS for Ph.D. Student Portal (C.S.E.D., Thapar University)
SRS for Ph.D. Student Portal (C.S.E.D., Thapar University)
 
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPTImage Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
 
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...
 
Developing Interactive Landslide Simulator
Developing Interactive Landslide SimulatorDeveloping Interactive Landslide Simulator
Developing Interactive Landslide Simulator
 
Developing Interactive Landslide Simulator (Poster)
Developing Interactive Landslide Simulator (Poster)Developing Interactive Landslide Simulator (Poster)
Developing Interactive Landslide Simulator (Poster)
 
Developing Interactive Landslide Simulator (Report)
Developing Interactive Landslide Simulator (Report)Developing Interactive Landslide Simulator (Report)
Developing Interactive Landslide Simulator (Report)
 
Emotional Regulation and Stress Burnout
Emotional Regulation and Stress BurnoutEmotional Regulation and Stress Burnout
Emotional Regulation and Stress Burnout
 
Asynchronous processors Poster
Asynchronous processors PosterAsynchronous processors Poster
Asynchronous processors Poster
 
Asynchronous Processors - The Clock less Future
Asynchronous Processors - The Clock less FutureAsynchronous Processors - The Clock less Future
Asynchronous Processors - The Clock less Future
 

Recently uploaded

basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
Ratnakar Mikkili
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
PauloRodrigues104553
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
drwaing
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 

Recently uploaded (20)

basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 

Souvenir's Booth - Algorithm Design and Analysis Project Project Report

  • 1. ANALYSIS AND DESIGN OF ALGORITHMS (UCS 501) PROJECT REPORT Souvenir's Booth Using Auto Complete Abhinav Garg(101303004) Akshit Arora(101303012) Chahak Gupta(101303041) 1/12/2015 Submitted To- Ms. Tarunpreet Bhatia
  • 2. SOUVENIR’S BOOTH USING AUTO COMPLETE 1 Acknowledgement__________________________________________________________________ We take this opportunity to express my profound gratitude and deep regards to Ms. Tarunpreet Bhatia for her cordial support, valuable information and guidance, which helped us in completing this task through various stages while I did face many problem regarding my project "Souvenir's Booth". She explained the concepts of algorithmic techniques in an illustrious manner along with providing the necessary guidance through links. This work simply would not have reached up to such extent without her rational guidance. Lastly, I thank almighty, my family members and friends for their constant encouragement without which this assignment would not be possible.
  • 3. SOUVENIR’S BOOTH USING AUTO COMPLETE 2 INDEX Sr. No. Title Page Number 1. Abstract 3 2. Introduction 4 3. Objective 5 4. Literature Review 6 5. Algorithmic Techniques Used 6 6. Code 7 7. Schema of Database 10 8. Asymptotic Analysis 11 9. Working Examples 12 11. Conclusion 14 12. Contribution to Society 14 13. References 16
  • 4. SOUVENIR’S BOOTH USING AUTO COMPLETE 3 Abstract_______________________________________________________________________________ Auto Complete is the most important feature and essential tool when it comes to accessing web search engines such as Google, Yahoo, and YouTube etc. Although it is intensively used on internet. Auto-complete features in many offline activities as well. Finest example can be smart phones. Not only smart phones provide most accurate words but they also predict the words based on the priorities of the users like previous search history. Form the utilities of this features in wide application made us to analyze this feature and implement this feature in most efficient way possible. We implemented auto complete using Trie and analysed the time complexity of this algorithm.
  • 5. SOUVENIR’S BOOTH USING AUTO COMPLETE 4 Introduction__________________________________________________________________________ Over the previous couple of years, auto-complete has exploded up all over the web. Facebook, YouTube, Google, Bing, MSDN, LinkedIn and lots of new websites all try to complete your phrase as soon as you start typing. Autocomplete speeds up human-computer interactions when it correctly predicts words being typed. It works best in domains with a limited number of possible words (such as in command), when some words are much more common (such as when addressing an e-mail), or writing structured and predictable text (as in source code editors). Many autocomplete algorithms learn new words after the user has written them a few times, and can suggest alternatives based on the learned habits of the individual user done by using machine learning. Here, we implement auto complete in a game. The player gets an ordered set of alphabets called POX. The player needs to use those starting alphabets and make a word. Any word in the English language starting with POX may or may not exist. If there doesn't exist any such word then he has to use the maximum possible string from POX starting from its first letter. If he is not able to make a word with POX but such a word exists in the English language then he is awarded zero points. If he is able to make any such word then he'll be given points according to the letters in the word. Now Sukriti wants his friend Abhinav who is a programmer to make a program that helps him find the possible words so that she can choose from them. We use a dictionary as data store for storing the words. When we type few letters of a word, we can do a regular expression match each time through the dictionary text file and print the words that starting the letters. Trie data structure is a tree with each node consisting of one letter as data and pointer to the next node. It uses Finite Deterministic automation. That means, it uses state to state transition. Words are paths along this tree and the root node has no characters associated with it. 1. The value of each node is the path or the character sequence leading up to it. 2. The children at each node are ideally represented using a hash table mapping the next character to the child nodes. 3. It’s also useful to set a flag at every node to indicate whether a word/phrase ends there. The insertion cost has a linear relationship with the string length. Now let’s define the methods for listing all the strings which start with a certain prefix. The idea is to traverse down to the node representing the prefix and from there do a breadth first search of all the nodes that are descendants of the prefix node. We check if the node is at a word boundary from the flag we defined earlier and append the node’s value to the results. A caveat of the recursive approach, is you might run into stack depth problems when the maximum length of a string reaches tens of thousands of characters.
  • 6. SOUVENIR’S BOOTH USING AUTO COMPLETE 5 Objectives____________________________________________________________________________ 1) To optimize auto-completion of the word. 2) To optimize Depth first search by improving the traversal of data structure by special algorithm and analysis techniques. 3) To Search Word in the Trie. 4) Modify the default Structure of Trie and with certain tweaks improve the overall time complexity. 5) We substantially increased the number of word in the Trie from 4 to 45000 words and it worked correctly.
  • 7. SOUVENIR’S BOOTH USING AUTO COMPLETE 6 Literature Review___________________________________________________________________ There are many algorithms and data structures to index and search strings inside a text, some of them are included in the standard libraries, but not all of them; the trie data structure is a good example of one that isn’t. Let word be a single string and let dictionary be a large set of words. If we have a dictionary, and we need to know if a single word is inside of the dictionary the tries are a data structure that can help us. But you may be asking yourself, “Why use tries if set <string> and hash tables can do the same?” There are two main reasons: The tries can insert and find strings in O(L) time (where L represent the length of a single word). This is much faster than set, but is it a bit faster than a hash table.  The trie is a tree where each vertex represents a single word or a prefix.  The root represents an empty string (“”), the vertexes that are direct sons of the root represent prefixes of length 1, the vertexes that are 2 edges of distance from the root represent prefixes of length 2, the vertexes that are 3 edges of distance from the root represent prefixes of length 3 and so on. In other words, a vertex that are k edges of distance of the root have an associated prefix of length k.  Let v and w be two vertexes of the trie, and assume that v is a direct father of w, then v must have an associated prefix of w. The next figure shows a trie with the words “tree”, “trie”, “algo”, “assoc”, “all”, and “also.” Note that every vertex of the tree does not store entire prefixes or entire words. The idea is that the program should remember the word that represents each vertex while lower in the tree.
  • 8. SOUVENIR’S BOOTH USING AUTO COMPLETE 7 Algorithmic Techniques_____________________________________________________________  For printing all possible words in a trie with given root: Backtracking Traversal (similar to DFS)  For searching the prefix in trie: naïve algorithm used  For insertion of new words in trie: Recursion Code___________________________________________________________________________________ #include<iostream> #include<fstream> #include<string> using namespace std; //Global variables (for the purpose of flags) => //found: to indicate whether the word is found or not //len: to indicate user specified length int found=0,len=-9999; class node{ //Node class public: char info; //the letter corresponding to node is stored here string Word; //for storing words (if completed) till that node class node* ptrs[256]; //to hold the pointers to 256 next possible letters (ASCII) node(){ //node class constructor for(int i=0;i<256;i++){ ptrs[i]=NULL; } info=NULL; Word=""; } }; void insertword(string word,int pos,class node * root){ //function to insert word if(word.length()==pos){ //if last position is reached root->Word=word; //Put the final word into node return; }
  • 9. SOUVENIR’S BOOTH USING AUTO COMPLETE 8 if( root-> ptrs[word[pos]]==NULL ){ //if next letter is not found node *newnode; //create new node newnode= new node; newnode->info=word[pos]; //with info = letter to store root->ptrs[word[pos]]=newnode; //pointer from current letter to next letter's node insertword(word,pos+1,root->ptrs[word[pos]]); //call insert word finction again with next position } else insertword(word,pos+1,root->ptrs[word[pos]]); //if next letter to add already exists } //call insert word directly void printall(class node * root){ //function to print all possible words given root of trie for(int i=0;i<256;i++) //for all 256 pointers in the provided root node if(root->ptrs[i]!=NULL){ //if those pointers are not null printall(root->ptrs[i]); //call printall recursively at each one of them } //Similar to DFS traversal //following code will be executed when the recursion starts backtracking if(root->Word != "" && (root->Word.length()==len && len!=-9999)) //first user specified length words will be searched cout<<" -> "<<root->Word<<endl; //and printed if they exist else if(root->Word != "" && len==-9999) //otherwise, all matching words are printed { cout<<" -> "<<root->Word<<endl; found=1; } } void suggest(string key,int pos, class node * root){ //function to print suggested words
  • 10. SOUVENIR’S BOOTH USING AUTO COMPLETE 9 if(root->ptrs[key[pos]] != NULL){ //if node is the last position of given key suggest(key,pos+1,root->ptrs[key[pos]]); //call suggest with next position } else{ printall(root); //when last node, print all words below it } } int main(){ ifstream in("wordlist.txt"); //input file "wordlist.txt" string word,current="",key; char ch; node *root; //root node of trie defined root = new node; while(in){ in>>word; //file parsed and all words input to trie insertword(word,0,root); } in.close(); //file stream closed cout<<endl<<"Trie has been created successfully!"<<endl; //trie created cout<<"Enter the starting letters of the word : "; cin>>key; //input key from user cout<<"Do you know the length of the word?(y/n)"; //input required word length(if any) cin>>ch; sos: if(ch=='y') { cout<<"Enter the lengthn"; cin>>len; if(len<=0) { //if user enters incorrect string length cout<<"Please enter a length greater than 0.n"; goto sos; } }
  • 11. SOUVENIR’S BOOTH USING AUTO COMPLETE 10 cout<<endl<<"Possible suggestions are :"<<endl; suggest(key,0,root); //suggest function call if(found && ch=='y') { cout<<"No words of specified length found"; //if no string found } return 0; } Schema of Databse____________________________________________________________________ It is the file-based database which used to store words for the Trie. Initially we took 1000 words and inserted them into the Trie. The words in the file can be of same prefix or different prefix. As we optimized the code we could store up to 45000 words in the Trie.
  • 12. SOUVENIR’S BOOTH USING AUTO COMPLETE 11 Asymptotic Analysis__________________________________________________________________ Space Complexity In worst case analysis, the dictionary will consist of words with no common prefix. At every level, 256 combinations will be possible from each node. So this will result in a lot of memory usage. Maximum number of nodes possible at level 1=256 Maximum number of nodes possible at level 2=2562 Maximum number of nodes possible at level 3=2563 Maximum number of nodes possible at level 4=2564 . . .
  • 13. SOUVENIR’S BOOTH USING AUTO COMPLETE 12 Maximum number of nodes possible at level m=256m Maximum total number of nodes in a trie with m as maximum length of word is: 256+2562 +2563 +2564 +……………. 256m = (256(256m +1 – 1) )/( 256-1) = (256/255) (256m+1 – 1) = O(256m ) So trie will have exponential space complexity in worst case complexity. Time Complexity The key determines trie depth. Trie will have linear time complexities in all the cases. So it is considered to be the most efficient algorithm for implementing trie data structure in spite of large space complexity. Using trie, we can search / insert the single key in O(M) time. Here, M is maximum string length. In this project, we get the search result in O(key_length + ∑(L)), where key_length is input given by user and ∑(L) is summation of all the string lengths starting with prefix entered by user. Working Examples____________________________________________________________________ Figure 1: Output when user doesn't know length.
  • 14. SOUVENIR’S BOOTH USING AUTO COMPLETE 13 Figure 2: Output when user inputs non-positive length Figure 3: Output when specified length matches Figure 4: The dictionary
  • 15. SOUVENIR’S BOOTH USING AUTO COMPLETE 14 Conclusion__________________________________________________________________________  Sukriti's problem of finding the desired solution was solved.  Auto complete was successfully implemented using Trie.  Suggests words if words of desired length are not available.  DFS and Trie's implementation was understood. Contribution to Society_______________________________________________________________ Auto Complete speeds up human-computer interactions when it correctly predicts words being typed. It works best in domains with a limited number of possible words (such as in command line interpreters), when some words are much more common (such as when addressing an e-mail), or writing structured and predictable text (as in source code editors). Works for: 1. Web Browsers 2. E-Mail Programs 3. Search Engines 4. Source Code 5. Word Processors 6. Command-Line Interpreters
  • 16. SOUVENIR’S BOOTH USING AUTO COMPLETE 15 References_____________________________________________________________________________  http://v1v3kn.tumblr.com/post/18238156967/roll-your-own-autocomplete-solution- using-tries  https://www.topcoder.com/community/data-science/data-science-tutorials/using-tries/  http://igoro.com/archive/efficient-auto-complete-with-a-ternary-search-tree/  https://en.wikipedia.org/wiki/Autocomplete  https://en.wikipedia.org/wiki/Trie  http://www.geeksforgeeks.org/trie-insert-and-search/