Lost Password?


Go Back   CodeCall Programming Forum > Software Development > General Programming

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-16-2007, 07:02 PM
UberMeister UberMeister is offline
Newbie
 
Join Date: Dec 2007
Posts: 9
Rep Power: 0
UberMeister is on a distinguished road
Default Arrays

I'm not complety sure if this is the right place but i need A LOT of help learning array processing in pseudocode. is their anyone that could direct me to a tutorial where you break it down step by step?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 12-17-2007, 09:51 AM
v0id's Avatar   
v0id v0id is offline
Retired
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,635
Last Blog:
CherryPy(thon)
Rep Power: 28
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default

Is there something particular about arrays you want to know, or just in general?
__________________
05-03-2007 - 11-13-2008
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-17-2007, 11:40 AM
WingedPanther's Avatar   
WingedPanther WingedPanther is online now
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,278
Last Blog:
wxWidgets is NOT code ...
Rep Power: 36
WingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to all
Default

If you do a search for array tutorials in almost any language, you should get the idea. You will find very few tutorials on anything in pseudocode.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-17-2007, 12:43 PM
UberMeister UberMeister is offline
Newbie
 
Join Date: Dec 2007
Posts: 9
Rep Power: 0
UberMeister is on a distinguished road
Default

Quote:
Originally Posted by v0id View Post
Is there something particular about arrays you want to know, or just in general?
everything in general.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-18-2007, 12:04 PM
UberMeister UberMeister is offline
Newbie
 
Join Date: Dec 2007
Posts: 9
Rep Power: 0
UberMeister is on a distinguished road
Default

What does it mean when an element is set to false?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 12-18-2007, 01:32 PM
v0id's Avatar   
v0id v0id is offline
Retired
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,635
Last Blog:
CherryPy(thon)
Rep Power: 28
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default

An array consists of multiple elements. Each of the elements carry some data or value. Depending on the language you're using, you can specify which type the array is, and what type all its elements is as well. If it's an array declared to hold boolean-values, the array is holding elements which can be given either True or False.
This is an example in the C++ programming language;
Code:
bool Array[3]; // Array with three elements

Array[0] = false;
Array[1] = true;
// ...
As you see, we set the first element to False, and the next to True. If it isn't this you're looking for, I'd like if you could give me a more detailed explanation of what you really want.

Note: "Element" is only one of the words used. Other common words include "cell" and "item".
__________________
05-03-2007 - 11-13-2008
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 12-19-2007, 12:32 PM
CygnetGames's Avatar   
CygnetGames CygnetGames is offline
Programmer
 
Join Date: May 2007
Location: York, England
Posts: 113
Rep Power: 6
CygnetGames is on a distinguished road
Default

One other point about "setting an element to false".
Sometimes, when using an array, you might want to remove an element from the array but not incur the cost of moving everything below the deleted element up one position.
To avoid this, you can mark an element as "deleted", so that it can be removed quickly from the array. You just have to remember when processing the array, not to process the deleted items.

For example, say you are storing numbers in your array and you have an array like this:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
You want to delete item 5.

One way to do this would be to shift item 6 into position 5, shift item 7 into position 6, shift item 8 into position 7, etc. to end up with this:
[1, 2, 3, 4, 6, 7, 8, 9, 10]
This takes a lot of time, as you have to move 5 items in order to delete just one.

Using the alternative method, you would replace item 5 with a "deleted" symbol, like this:
[1, 2, 3, 4, X, 6, 7, 8, 9, 10]
This is much quicker, as you only have to do one thing to the array.

The problems with this method are that you have to remember to ignore the "X" element when you process the array (e.g. to print out the elements), and you have to make sure that you are not wanting to store the item "X" in your array.
This is ok in this example because we're storing numbers in the array and "X" is not a number, it's a character.
The usual thing to use instead of "X" is a symbol called "null". This is built into most languages and means "an empty space in memory". But there are some situations in which you would want to store "null" in an array, so this approach does not always work.

As void said, you must always know what data types are being stored in your array.

Hope that helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 03-04-2008, 12:54 PM
Avishek Avishek is offline
Newbie
 
Join Date: Mar 2008
Posts: 1
Rep Power: 0
Avishek is on a distinguished road
Default Help Me with confussion

4. An elementary school contains 30 classrooms numbered 1 through 30. Each classroom can contain any number of students up to 35. Each student takes an achievement test at the end of the school year and receives a score from 0 through 100. One record is created for each student in the school; each record contains a student ID, classroom number, and score on the achievement test.

Design a Student class and the logic for an application that lists the total points scored for each of the 30 classrooms.

Student
-studentId: numeric
-classroomNumber: numeric
-score: numeric
+getStudentId(): numeric
+getClassroomNumber(): numeric
+getScore(): numeric
+setStudentId(numeric id): void
+setClassroomNumber(numeric number): void
+setScore(numeric score): void















public class CountTotalPoints
constant numeric NUM_CLASSROOMS = 30
numeric points[NUM_ CLASSROOMS]
numeric sub = 0

while sub < NUM_ CLASSROOMS
points[sub] = 0
sub = sub + 1
endwhile

public static void main()
Student stu
open(inputFile)
stu = read(inputFile)
while stu not EOF
countPoints(stu)
stu = read(inputFile)
endwhile
printReport()
close(inputFile)
return

public static void countPoints(Student stu)
numeric class
class = stu.getClassroomNumber()
points[class-1] = points[class-1] + stu.getScore()
return

public static void printReport()
numeric class
print “Classroom Report”
print “Classroom # Total points scored”
class = 0
while class < NUM_ CLASSROOMS
print (class+1), points[class]
class = class+1
endwhile
return
endClass

The question is how to modify this pseudocode so that each classroom’s average of the test scores prints, rather than each classroom’s total.

I ll appriciate the help Thank You
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dealing with Arrays sthenri Java Help 2 12-11-2007 01:22 AM
Dynamic Arrays Fedex C and C++ 3 12-02-2007 05:45 PM
Help regarding the sorting of arrays with flags! Yuriy M C and C++ 3 10-12-2007 11:30 PM
Python arrays... Sir_Rimo Python 3 06-20-2007 09:54 AM
Arrays clookid PHP Tutorials 1 01-11-2007 09:30 PM


All times are GMT -5. The time now is 05:43 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 98%

Ads