Tuesday, 1 May 2012

Re: ||| VuHelp4U ||| cs301 idea solution

ak mint ma sir sy cnfirn kr k btati hn kiun k mjh khd bi confusion ho ri

On Tue, May 1, 2012 at 9:10 PM, Hamid Khan <pathfinder610@gmail.com> wrote:
ye meri hai
abi problem hai isme
 
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<windows.h>
typedef struct BST
{
        int data;
        struct BST *lchild, *rchild;
}
node;
       
        void insert (node *,node *);
        void inorder (node *);
        void preorder (node *);
        void postorder (node *);
        node *search (node *, int , node **);
       
        int main()
        {
             int choice;
             char ans = 'N';
             int key;
             node *new_node, *root, *tmp, *parent;
             node *get_node();
             root = NULL;
             system("CLS");
             printf("\nProgram For Binary Search Tree");
             do
             {
                  printf("\n1. Create");
                  printf("\n2. Search");
                  printf("\n3. Recursive Traversals");
                  printf("\n4. Exit");
                  cout<<"\nEnter your choice: ";
                  scanf("%d", &choice);
                 
                  switch(choice)
                  {
                     case 1:
                          do
                          {
                             new_node=get_node();
                             printf("\nEnter The Element ");
                             scanf("%d", &new_node->data);
                             if(root==NULL)
                             root = new_node;
                             else
                             insert (root, new_node);
                             printf("\nWant to enter more elements?(y/n)");
                             cin>>ans;
                          }
                          while (ans == 'y');
                          break;
                    
                     case 2:
                           printf("\nEnter Element to be searched: ");
                           cin>>key;
                           tmp = search (root, key, &parent);
                           printf("\nParent of node %d is %d ", tmp->data, parent->data);
                           break;
                          
                     case 3:
                          if (root==NULL)
                          printf("Tree is not created");
                          else
                          {
                              printf("\nThe Inorder display: ");
                              inorder(root);
                              printf("\nThe Pre-order display: ");
                              preorder(root);
                              printf("\nThe Post-order display: ");
                              postorder(root);
                          }   
                          break;
                  }
                  while (choice !=4);
             }
             node *get_node();
             {
                  node *temp;
                  temp = (node *)malloc(sizeof(node));
                  temp->lchild=NULL;
                  temp->rchild=NULL;
                  return temp;
             }
          void insert (node *root, node *new_node);
          {
               if(new node ->data > root ->data)
               {
                      if (root->lchild==NULL)
                      root->lchild = new_node;
                      else
                      insert (root->lchild , new_node);
               }
               if(new_node->data > root -> data)
               {
                      if(root->rchild==NULL)
                      root->rchild = new_node;
                      else
                      insert(root->rchild, new_node);
               }
          }
          node *search(node *root, int key, node**parent)
          {
               node *temp;
               temp = root;
               while (temp != NULL)
               {
                     if(temp->data==key)
                     {
                         printf("\nThe %d Element is present", temp->data);
                         return temp;
                     }
                     *parent = temp;
                     if(temp->data==key)
                     temp=temp->rchild;
                     else
                     temp=temp->rchild;
               }
               return NULL;
          }
          void inorder (node *temp)
          {
               if(temp != NULL)
               {
                  inorder(temp->lchild);
                  printf("%d", temp->data);
                  inorder (temp->rchild);
               }
          }
          void preorder (node *temp)
          {
               if(temp != NULL)
               {
                  printf("%d", temp->data);
                  preorder(temp->lchild);
                  preorder(temp->rchild);
               }
          }
          void preorder (node *temp)
          {
               if(temp != NULL)
               {
                  postorder(temp->lchild);
                  postorder(temp->rchild);
                  printf("%d", temp->data);
               }
          }       


On 1 May 2012 21:08, aneela khan <akhan6274@gmail.com> wrote:
mri to totally chang hy ap sy


On Tue, May 1, 2012 at 9:06 PM, Hamid Khan <pathfinder610@gmail.com> wrote:
jo apk pas file hai wo tu share krdo. sir jab chk kr lain phr cnfrm kr dena wo b.


 
On 1 May 2012 21:04, aneela khan <akhan6274@gmail.com> wrote:
ori mjh ab tk mili e nae hy na.mry teachr abi busy hain.ma pta krti wait


On Tue, May 1, 2012 at 9:02 PM, Hamid Khan <pathfinder610@gmail.com> wrote:
ap solution tu de do plz.
28 errors they c mai
ab 15 reh gaye hain
ab mje smj ni aara k kese new node lena hai c++ mai.


 
On 1 May 2012 21:00, aneela khan <akhan6274@gmail.com> wrote:
o ji ye c++ ma nae hota ji.galt hy


On Tue, May 1, 2012 at 8:52 PM, Hamid Khan <pathfinder610@gmail.com> wrote:
o bhai mere ye solution ni hai
kia ho gya apko?????????????????????????????

On 1 May 2012 20:07, waqas ijaz <waqasijaz007@gmail.com> wrote:
string& insert ( size_t pos1, const string& str );
string& insert ( size_t pos1, const string& str, size_t pos2, size_t n );
string& insert ( size_t pos1, const char* s, size_t n);
string& insert ( size_t pos1, const char* s );
string& insert ( size_t pos1, size_t n, char c );
iterator insert ( iterator p, char c );
void insert ( iterator p, size_t n, char c );
template<class InputIterator>
void insert ( iterator p, InputIterator first, InputIterator last );

Insert into string
The current string content is extended by inserting some additional content at a specific location within the string content (this position is determined by either pos1 or p, depending on the function version used).

The arguments passed to the function determine the content that is inserted:

keep me in your prayers
string& insert ( size_t pos1, const string& str );
Inserts a copy of the entire string object str at character position pos1.
string& insert ( size_t pos1, const string& str, size_t pos2, size_t n );
Inserts a copy of a substring of str at character position pos1. The substring is the portion of str that begins at the character position pos2 and takes up to n characters (it takes less than n if the end of str is reached before).
string& insert ( size_t pos1, const char * s, size_t n );
Inserts at the character position pos1, a copy of the string formed by the first n characters in the array of characters pointed by s.
string& insert ( size_t pos1, const char * s );
Inserts at character position pos1, a copy of the string formed by the null-terminated character sequence (C string) pointed by s. The length of this character sequence is determined by the first ocurrence of a null character (as determined by traits.length(s)).
string& insert ( size_t pos1, size_t n, char c );
Inserts a string formed by a repetition of character c, n times, at the character position pos1.
iterator insert ( iterator p, char c );
Inserts a copy of character c at the position referred by iterator p and returns an iterator referring to this position where it has been inserted.
void insert ( iterator p, size_t n, char c );
Inserts a string formed by the repetition of character c, n times, at the position referred by iterator p.
template<class InputIterator> void insert (iterator p, InputIterator first, InputIterator last);
Inserts at the internal position referred by p the content made up of the characters that go from the element referred by iterator first to the element right before the one referred by iterator last.

--
M.Waqas
waqasijaz007@yahoo.com

--
To post to this group, send email to vuhelp_pk@googlegroups.com
To unsubscribe from this group, send email to vuhelp_pk+unsubscribe@googlegroups.com
 
 
Group Rules Vuhelp4u
Sharing of Video songs links, movies links, dramas links are not allowed in study group. Only Islamic and general information Video links allowed.
SPAM, Advertisement, and Adult messages are NOT allowed and that member will be behaved strictly.
http://groups.google.com/group/vuhelp_pk?hl=en_US

--
To post to this group, send email to vuhelp_pk@googlegroups.com
To unsubscribe from this group, send email to vuhelp_pk+unsubscribe@googlegroups.com
 
 
Group Rules Vuhelp4u
Sharing of Video songs links, movies links, dramas links are not allowed in study group. Only Islamic and general information Video links allowed.
SPAM, Advertisement, and Adult messages are NOT allowed and that member will be behaved strictly.
http://groups.google.com/group/vuhelp_pk?hl=en_US

--
To post to this group, send email to vuhelp_pk@googlegroups.com
To unsubscribe from this group, send email to vuhelp_pk+unsubscribe@googlegroups.com
 
 
Group Rules Vuhelp4u
Sharing of Video songs links, movies links, dramas links are not allowed in study group. Only Islamic and general information Video links allowed.
SPAM, Advertisement, and Adult messages are NOT allowed and that member will be behaved strictly.
http://groups.google.com/group/vuhelp_pk?hl=en_US

--
To post to this group, send email to vuhelp_pk@googlegroups.com
To unsubscribe from this group, send email to vuhelp_pk+unsubscribe@googlegroups.com
 
 
Group Rules Vuhelp4u
Sharing of Video songs links, movies links, dramas links are not allowed in study group. Only Islamic and general information Video links allowed.
SPAM, Advertisement, and Adult messages are NOT allowed and that member will be behaved strictly.
http://groups.google.com/group/vuhelp_pk?hl=en_US

--
To post to this group, send email to vuhelp_pk@googlegroups.com
To unsubscribe from this group, send email to vuhelp_pk+unsubscribe@googlegroups.com
 
 
Group Rules Vuhelp4u
Sharing of Video songs links, movies links, dramas links are not allowed in study group. Only Islamic and general information Video links allowed.
SPAM, Advertisement, and Adult messages are NOT allowed and that member will be behaved strictly.
http://groups.google.com/group/vuhelp_pk?hl=en_US

--
To post to this group, send email to vuhelp_pk@googlegroups.com
To unsubscribe from this group, send email to vuhelp_pk+unsubscribe@googlegroups.com
 
 
Group Rules Vuhelp4u
Sharing of Video songs links, movies links, dramas links are not allowed in study group. Only Islamic and general information Video links allowed.
SPAM, Advertisement, and Adult messages are NOT allowed and that member will be behaved strictly.
http://groups.google.com/group/vuhelp_pk?hl=en_US

--
To post to this group, send email to vuhelp_pk@googlegroups.com
To unsubscribe from this group, send email to vuhelp_pk+unsubscribe@googlegroups.com
 
 
Group Rules Vuhelp4u
Sharing of Video songs links, movies links, dramas links are not allowed in study group. Only Islamic and general information Video links allowed.
SPAM, Advertisement, and Adult messages are NOT allowed and that member will be behaved strictly.
http://groups.google.com/group/vuhelp_pk?hl=en_US

--
To post to this group, send email to vuhelp_pk@googlegroups.com
To unsubscribe from this group, send email to vuhelp_pk+unsubscribe@googlegroups.com
 
 
Group Rules Vuhelp4u
Sharing of Video songs links, movies links, dramas links are not allowed in study group. Only Islamic and general information Video links allowed.
SPAM, Advertisement, and Adult messages are NOT allowed and that member will be behaved strictly.
http://groups.google.com/group/vuhelp_pk?hl=en_US

--
To post to this group, send email to vuhelp_pk@googlegroups.com
To unsubscribe from this group, send email to vuhelp_pk+unsubscribe@googlegroups.com
 
 
Group Rules Vuhelp4u
Sharing of Video songs links, movies links, dramas links are not allowed in study group. Only Islamic and general information Video links allowed.
SPAM, Advertisement, and Adult messages are NOT allowed and that member will be behaved strictly.
http://groups.google.com/group/vuhelp_pk?hl=en_US

No comments:

Post a Comment