Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 150
» Latest member: Spooky Boogie
» Forum threads: 112
» Forum posts: 361

Full Statistics

Online Users
There are currently 10 online users.
» 2 Member(s) | 8 Guest(s)
fplux, sammaryland

Latest Threads
log log n Interpretation
Forum: Exam 1
Last Post: sammaryland
1 hour ago
» Replies: 1
» Views: 7
MRT Question
Forum: Exam 1
Last Post: sammaryland
9 hours ago
» Replies: 2
» Views: 37
freeing strings and token...
Forum: Project 1
Last Post: NiceHam
Yesterday, 03:57 PM
» Replies: 2
» Views: 107
Review Session
Forum: Study Groups
Last Post: kamadson
Yesterday, 03:19 AM
» Replies: 0
» Views: 12
Tokens or quoted strings
Forum: Project 1
Last Post: sbcarp
02-17-2018, 05:26 PM
» Replies: 2
» Views: 83
extractHEAP
Forum: Project 1
Last Post: chibbluffy
02-17-2018, 05:50 AM
» Replies: 2
» Views: 103
What was it I said I woul...
Forum: Miscellany
Last Post: sammaryland
02-16-2018, 08:07 PM
» Replies: 1
» Views: 46
Is root node a leaf node?
Forum: Project 1
Last Post: lusth
02-16-2018, 03:36 PM
» Replies: 2
» Views: 109
Max or min heap
Forum: Project 1
Last Post: chibbluffy
02-16-2018, 08:01 AM
» Replies: 1
» Views: 121
Heap test
Forum: Project 1
Last Post: chibbluffy
02-16-2018, 03:50 AM
» Replies: 4
» Views: 144

 
  Resubmission 1 Test Files
Posted by: _helloben - 02-06-2018, 09:42 PM - Forum: Project 0 - Replies (2)

Hi,

I just wanted to point out that the test files used in resubmission 1 grading and the files available to download through resubmission 1 are not the same. This is sad because if you missed some test cases in resubmission 1, you can't get the right test files to do an official debug.

Print this item

  deleteBST() questions
Posted by: reiddewberry - 02-06-2018, 04:58 PM - Forum: Project 1 - Replies (3)

For the deleteBST() function, a BST and a void* is passed in. Are we supposed to search the BST for a node with the value and then move that node to a leaf and prune it?

and is the BST unique or are we supposed to continually search until all nodes with that value is gone?

Thank you.

Print this item

  Clarification on Specs
Posted by: chibbluffy - 02-06-2018, 04:36 PM - Forum: Project 1 - Replies (3)

For setBSTroot, we take in a BST *t and a BSTNODE *replacement. All the spec says is to update the root pointer. Does this mean, all we do is set root to replacement? Then what happens to the old root 't', if we just set the new root to replacement? I'm assuming we free that. Or do we replace the value in the root with the value of replacement?


In the provided header for BST, there is a setBSTsize, but the spec doesn't say anything about it. Do we need this? Since insert should handle updating size anyways? I don't see why you would need to update size outside of insert and remove.

For the BST, the comparator determines if the value is greater than or less than, then other things run according to the result. What happens if the values are the same? Can we just assume that cannot happen? or are we supposed to assume something else?

Print this item

  Display BST requirements and test discrepancy
Posted by: fplux - 02-06-2018, 04:36 PM - Forum: Project 1 - Replies (11)

The project specs specify displayBST to print in preorder, but the test on the server labels it as inorder before it calls the display function.

Print this item

  How long should the last DLL test take?
Posted by: scsheriff - 02-05-2018, 05:10 AM - Forum: Project 0 - Replies (1)

During the test run by dll-0-14.c my implementation does the inserts very quickly then hangs on the gets/sets. I added a print statement and can see that it is still running and seems to be constant time for each one, but going through a million is taking minutes. Should this take only a few seconds or less, or is this normal behavior?


Nevermind, I fixed it. I had accidentally forgotten a part of my setDLL conditionals.

Print this item

  Running all tests at once
Posted by: magarwal - 02-04-2018, 11:10 PM - Forum: Project 0 - Replies (1)

I've found a way to run all the tests with a single command. This should help with debugging your code.

Here's my makefile (the relevant portions are at the very top and the bottom):

Code:
OBJS = integer.o real.o string.o
MAIN =  sll.o dll.o stack.o queue.o
TESTS = test-sll test-dll test-stack test-queue $(SLLtests) $(QUEUEtests) $(DLLtests) $(STACKtests)
OOPTS = -Wall -Wextra -g -c
LOPTS = -Wall -Wextra -g
SLLtests = sll-0-0 sll-0-1 sll-0-2 sll-0-3 sll-0-4 sll-0-5 sll-0-6 sll-0-7 sll-0-8 sll-0-9 sll-0-10 sll-0-11 sll-0-12 sll-0-13 sll-0-14
QUEUEtests = queue-0-0 queue-0-1 queue-0-2 queue-0-3 queue-0-4 queue-0-5 queue-0-6 queue-0-7 queue-0-8 queue-0-9
DLLtests = dll-0-0 dll-0-1 dll-0-2 dll-0-3 dll-0-4 dll-0-5 dll-0-6 dll-0-7 dll-0-8 dll-0-9 dll-0-10 dll-0-11 dll-0-12 dll-0-13 dll-0-14
STACKtests = stack-0-0 stack-0-1 stack-0-2 stack-0-3 stack-0-4 stack-0-5 stack-0-6 stack-0-7 stack-0-8 stack-0-9

all : $(OBJS) $(MAIN) $(TESTS)

test-sll : test-sll.o integer.o sll.o
    gcc $(LOPTS) test-sll.o $(OBJS) sll.o -o test-sll

test-dll : test-dll.o real.o dll.o
    gcc $(LOPTS) test-dll.o $(OBJS) dll.o -o test-dll

test-stack : test-stack.o string.o dll.o stack.o
    gcc $(LOPTS) test-stack.o $(OBJS) dll.o stack.o -o test-stack

test-queue : test-queue.o integer.o sll.o queue.o
    gcc $(LOPTS) test-queue.o $(OBJS) sll.o queue.o -o test-queue

test-sll.o : test-sll.c sll.h integer.h
    gcc $(OOPTS) test-sll.c

test-dll.o : test-dll.c dll.h real.h
    gcc $(OOPTS) test-dll.c

test-stack.o : test-stack.c stack.h string.h
    gcc $(OOPTS) test-stack.c

test-queue.o : test-queue.c queue.h integer.h
    gcc $(OOPTS) test-queue.c

stack.o : stack.c stack.h
    gcc $(OOPTS) stack.c

queue.o : queue.c queue.h dll.h
    gcc $(OOPTS) queue.c

sll.o : sll.c sll.h
    gcc $(OOPTS) sll.c

dll.o : dll.c dll.h
    gcc $(OOPTS) dll.c

integer.o : integer.c integer.h
    gcc $(OOPTS) integer.c

real.o : real.c real.h
    gcc $(OOPTS) real.c

string.o : string.c string.h
    gcc $(OOPTS) string.c

test : all
    for x in $(TESTS); do echo -------; echo $$x; echo -------; ./$$x; echo; done

valgrind: all
    for x in $(TESTS); do echo -------; echo valgrind $$x; echo -------; valgrind ./$$x; echo; done

clean :
    rm -f $(OBJS) $(MAIN) $(TESTS) test-*.o

debug : all
    for x in $(SLLtests) $(DLLtests) $(STACKtests) $(QUEUEtests); do echo -------; echo $$x; echo -------; ./$$x; echo; done

valgrind-debug: all
    for x in $(SLLtests) $(DLLtests) $(STACKtests) $(QUEUEtests); do echo -------; echo valgrind $$x; echo -------; valgrind ./$$x; echo; done

sll: $(SLLtests)
    for x in $(SLLtests); do make $$x; done

dll: $(DLLtests)
    for x in $(DLLtests); do make $$x; done

queue: $(QUEUEtests)
    for x in $(QUEUEtests); do make $$x; done

stack: $(STACKtests)
    for x in $(STACKtests); do make $$x; done

$(SLLtests): %: %.c sll.o
    gcc $(LOPTS) -o $@ $< $(OBJS) sll.o
    
$(DLLtests): %: %.c dll.o
    gcc $(LOPTS) -o $@ $< $(OBJS) dll.o

$(QUEUEtests): %: %.c queue.o sll.o
    gcc $(LOPTS) -o $@ $< $(OBJS) queue.o sll.o

$(STACKtests): %: %.c stack.o dll.o
    gcc $(LOPTS) -o $@ $< $(OBJS) stack.o dll.o


Running the following commands (or just make) will compile all your tests (from submission0.tgz):
Code:
make sll
make dll
make stack
make queue

And then you can run make debug > debug.txt to run all the tests at once and have the output piped to a text file. Modify it as you see fit.

Print this item

Star Errors with rm and cp when submitting to test server
Posted by: fplux - 02-04-2018, 10:09 PM - Forum: Project 0 - Replies (1)

When I submit my code to the test server, I see the following errors that I had not previously seen when submitting. I just want to confirm if they are from the script in the dropbox or something in my code/makefile.

Code:
!! TRYING YOUR SLL MODULE WITH ALTERNATE CODE

rm: cannot remove '../GOLD/testdir-sll/real.c': Permission denied
rm: cannot remove '../GOLD/testdir-sll/real.o': Permission denied
rm: cannot remove '../GOLD/testdir-sll/string.c': Permission denied
rm: cannot remove '../GOLD/testdir-sll/string.o': Permission denied
rm: cannot remove '../GOLD/testdir-sll/integer.c': Permission denied
rm: cannot remove '../GOLD/testdir-sll/real.h': Permission denied
rm: cannot remove '../GOLD/testdir-sll/integer.o': Permission denied
rm: cannot remove '../GOLD/testdir-sll/string.h': Permission denied
rm: cannot remove '../GOLD/testdir-sll/test-sll.c': Permission denied
rm: cannot remove '../GOLD/testdir-sll/sll.c': Permission denied
rm: cannot remove '../GOLD/testdir-sll/integer.h': Permission denied
rm: cannot remove '../GOLD/testdir-sll/sll.h': Permission denied
rm: cannot remove '../GOLD/testdir-sll/sll-0-0': Permission denied
rm: cannot remove '../GOLD/testdir-sll/sll.o': Permission denied
rm: cannot remove '../GOLD/testdir-sll/test-sll': Permission denied
rm: cannot remove '../GOLD/testdir-sll/makefile': Permission denied
rm: cannot remove '../GOLD/testdir-sll/tester.c': Permission denied
cp: cannot create regular file '../GOLD/testdir-sll/integer.c': Permission denied
cp: cannot create regular file '../GOLD/testdir-sll/integer.h': Permission denied
cp: cannot create regular file '../GOLD/testdir-sll/makefile': Permission denied
cp: cannot create regular file '../GOLD/testdir-sll/real.c': Permission denied
cp: cannot create regular file '../GOLD/testdir-sll/real.h': Permission denied
cp: cannot create regular file '../GOLD/testdir-sll/string.c': Permission denied
cp: cannot create regular file '../GOLD/testdir-sll/string.h': Permission denied
cp: cannot create regular file '../GOLD/testdir-sll/test-sll': Permission denied
cp: cannot create regular file '../GOLD/testdir-sll/test-sll.c': Permission denied
cp: cannot create regular file '../GOLD/testdir-sll/sll.c': Permission denied
cp: cannot create regular file '../GOLD/testdir-sll/sll.h': Permission denied
!! compiling the test program with your code
gcc -Wall -Wextra -g -c integer.c
gcc -Wall -Wextra -g -c real.c
gcc -Wall -Wextra -g -c string.c
gcc -Wall -Wextra -g -c sll.c
gcc -Wall -Wextra -g -o tester tester.c integer.o real.o string.o sll.o
!! compiling the test program with standard code
./file-tester-setup: line 42: tester.c: Permission denied
make: makefile: Permission denied
cc     tester.c   -o tester
tester.c:3:17: fatal error: sll.h: Permission denied
compilation terminated.
<builtin>: recipe for target 'tester' failed
make: *** [tester] Error 1
mv: cannot stat 'tester': No such file or directory

Print this item

  Testing for Runtimes
Posted by: NickXIV - 02-04-2018, 06:38 PM - Forum: Project 0 - Replies (3)

For anyone trying to make sure that your functions are running quickly enough:

clock_t start, end;

    double cpu_time_used;

    start = clock();

 //code that you want to be timed goes here

end = clock();

cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;

printf("%f", cpu_time_used);

Make sure that you include time.h

Print this item

  Resubmission timing
Posted by: Spooky Boogie - 02-04-2018, 04:54 PM - Forum: Project 0 - Replies (2)

I think delaying the resubmission time slightly would be beneficial. By the next resubmission, there will only have been 3 days of working time since we got results back. I think pushing it back to even Tuesday morning would be a big help. Does anyone else agree? Thanks for any consideration given

Print this item

  Geek fail
Posted by: lusth - 02-03-2018, 06:08 PM - Forum: Miscellany - Replies (2)

Seems I got both subtraction and multiplication backwards. For subtraction, the minuend is on the left and the subtrahend is on the right. For multiplication, the multiplier is on the left and the multiplicand is on the right.

Print this item