Honeywell Interview Question for Software Engineer / Developers


Team: Sharepoint COE
Country: India
Interview Type: Written Test




Comment hidden because of low score. Click to expand.
1
of 1 vote

{
	struct node* temp=start, *faltu=NULL;
	if(temp->ch=='A' || temp->ch=='E' || temp->ch=='I' || temp->ch=='O'|| temp->ch=='U')
	{
		faltu=temp;
	}
	while(temp->next)
	{
		if(temp->next->ch=='A' || temp->next->ch=='E' || temp->next->ch=='I' || temp->next->ch=='O'|| temp->next->ch=='U')
		{
			if(faltu==NULL)
			{
				faltu=temp->next;
				temp->next=temp->next->next;
				faltu->next=start;
				start=faltu;
			}
			else if(faltu->next==temp->next)
			{
				faltu=temp->next;
				temp=temp->next;	
			}
			else 
			{
					struct node* store=temp->next->next;
					temp->next->next=faltu->next;
					faltu->next=temp->next;
					temp->next=store;
			}
		}
		else temp=temp->next;
	}
}

- arun June 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Scan the list and keep track of the last vowel encountered. As soon as the current element is non-vowel(consonant), just skip it and continue scanning towards the end of the list. When the current element is a vowel, remove it from the list and add it as the next element of the last encountered vowel and make this newly added element as the last encountered vowel.

- ashot madatyan June 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

soory forgor to add full question question is how we can return Head pointer ?

- navi June 27, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Very easy - keep track of the first vowel encountered or the first vowel placed before the very first consonant and this vowel shall be your head pointer. If there are no vowels at all, just return the original head pointer, which will naturally be a consonant.

- ashot madatyan June 27, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

p=root;prev=NULL;
 
        if(p->alph=='A' || p->alph=='O')
                cur=root;
        else
                cur=NULL;
 
        while(p)
        {
                if(p->alph=='A' || p->alph=='O')
                {
                        if(prev!=NULL)
                        {               
                                prev->next=p->next;
                                if(cur==NULL)
                                {
                                        p->next=root;
                                        root=p;
                                }
                                else
                                {
                                        p->next=cur->next;
                                        cur->next=p;
                                }
                                cur=p;
                        }
                }
                prev=p;
                p=p->next;
        }

- Aashish June 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

How about the below algorithm:

1.Scan from the beginning of the list, ignoring consonants.
2.If you have a vowel at hand, copy it and create a new node at the beginning, update the head pointer and then delete the old node adjusting the pointers.

This would be an O(n) solution as we just need to have a single iteration over the array.

- Pavan Dittakavi June 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

wen you insert the vowel in the head, you need to traverse till you encounter a non vowel.

- apr June 27, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

void arrange(NODEPTR* m){
    if(*m == NULL){
        cout << "List is empty" << endl;
        return;
        }
    NODEPTR init,temp,p,q;
    init = (isVowel((*m)->data)) ? (*m) : NULL;
    q = *m;
    p = q->link;
    while(p != NULL){
        traverse(*m);
        if(isVowel(p->data)){
            //adding at beginning
            if(init == NULL){
                temp = p->link;
                p->link = *m;
                q->link = temp;
                *m = p;
                }
            else{
                temp = p->link;
                p->link = init->link;
                q->link = temp;
                init->link = p;
                }
            init = p;
            }
        else
            q = p;
        p = q->link;
        }
    }

- vagrawal13 June 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Just Traverse the Linked List as follows (given Head pointer )
having pointer's : temp ( for traversing ) Prev ( prev of Temp )
temp = Head ;
now move one by one
case 1> if you encounter Vowel ( temp is pointing to it ) so Prev is previous of temp and
Prev -> next = temp -> next ;
temp ->next = Head ;
Head = temp ;
temp = Prev ->next ;
and continue
case 2> if not a vowel ...continue ....

- Nitin Gupta iitian June 28, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

?/?????

- vowel and consonant re-arrangement in linked list using c October 07, 2015 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More