top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Implement the following functions recursively in the code linked list type

0 votes
84 views

int seqSearch(int key); // this is a member function of the linkedListType class. It searches for the value key in the linked list. If the key is found, then its position is returned. Otherwise, -1 is returned. NOTE: in order to implement this function, you need to implement another private member function to send it the first pointer. Here is the prototype for the private member function:

int recSeqSearch(nodeType *p, int key);

#include <iostream>
using namespace std;

struct nodeType
{
    int info;
    nodeType *next;
};

class linkedListType
{
public:
    linkedListType();
    int listSize();
    bool isEmpty();
    int seqSearch(int);
    void remove(int);
    void insertFirst(int);
    void insertEnd(int);
    void insertAt(int, int);
    void removeAt(int);
    void print();
    void clearList();
    void insertOrdered(int);
    void removeFirst();
    void removeLast();
    void removeLast2();
    int removeOddSumEven();
     ~linkedListType();  


private:
    nodeType *first, *last;
    int length;
};
posted Nov 23, 2013 by As M Ob

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button
Not sure about recursion but you can take a look at open implementations  they might have few of them in recursion.
https://github.com/zhemao/libds
http://home.gna.org/gdsl/

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...