Thread: Where to begin?

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    3

    Where to begin?

    Here is the question:

    Write a recursive lookup function to search an array in sorted order. Write a program in C to test your function. Use random() to fill array a[] of size n, and use bubble_sort() to sort the array. The function call look_up(v, a, n) should be used to look for the value v in the array a[]. If just one of the elements of the array, say a[i] has the value v, then i should be returned. If two or more of the elements of the array have the value v, then the index of any one of them in an acceptable answer.

    Can someone point me in the right direction on where to start? Thank you.

  2. #2

  3. #3
    Registered User
    Join Date
    Apr 2011
    Posts
    3
    I'm not asking for the answer to the question, I just want just help on how to start going about solving this.

  4. #4
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Have you ever written a program before? This is usually a good start:
    Code:
    int main(void)
    {
        // your code here
        return 0;
    }
    Read your text book and class notes. We have tutorials here, and Google has lots more. Work your way from beginning to end. Do the practice problems until you understand user input, arrays and function calls at the very least. Start writing your code, get as far as you can and come back when you're really stuck, not lazy stuck (to quote Tater). You need to put in some serious effort before you get serious help.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Can you write random()?
    Can you write bubble_sort()?
    Can you write look_up(), if you ignore the "recursive" bit (that is, just make it a simple loop)?

    You should be able to think about each one in turn without worrying too much about the whole picture.
    Plus, it would go a really long way to showing us that you're making an effort, and not just dumping your assignment on us, with no real indication as to what is really bothering you about it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How did you begin?
    By Swordsman in forum A Brief History of Cprogramming.com
    Replies: 31
    Last Post: 05-17-2007, 08:35 PM
  2. Not sure where to begin
    By wonderpoop in forum C Programming
    Replies: 13
    Last Post: 12-07-2006, 07:34 PM
  3. How would one begin?
    By Mr_Acclude in forum C++ Programming
    Replies: 5
    Last Post: 09-13-2005, 09:08 PM
  4. Where to begin...?
    By Ayden in forum Game Programming
    Replies: 4
    Last Post: 07-11-2005, 09:53 AM
  5. Where to begin...
    By tyouk in forum Windows Programming
    Replies: 2
    Last Post: 12-23-2004, 07:19 AM

Tags for this Thread