Sponsored Content
Homework and Emergencies Homework & Coursework Questions Heuristic Algorithm Example Analysis Post 302618087 by sureshcisco on Tuesday 3rd of April 2012 02:59:00 PM
Old 04-03-2012
Heuristic Algorithm Example Analysis

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:

It's a three step algorithm and it works fine. But I am trying to prove that it is not always true. See my example tries below both example 1 and 2 works fine according to the algorithm. but is there any counter example anyone can show which does not work with algorithm. (cannot use negative numbers).

2. Relevant commands, code, scripts, algorithms:

Code:
Sort {Xi} in descending order.
 Place files in tapes one at a time.
 For a file being considered, assign the file to the smaller tape.

3. The attempts at a solution (include all code and scripts):
Example1:
Let's say we have 4 numbers, 10, 9, 8, and 7 (sorted in decending order)

Tape1: 10
Tape2: 9

Next:
Tape1:10
Tape2: 9, 8 (assigned the file 8 to the smallest tape. now the total of tape2=17)

Next:
Tape1: 10, 7 (total 17)
Tape2: 9, 8 (total 17)


Example2: if we have numbers say 100, 50, 2, 1
The solution will be:
Tape1: 100
Tape2: 50, 2, 1


4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
UC Dresden, Dussolders, Deutchland, Prof Martan (online tutor), 206.

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
 

8 More Discussions You Might Find Interesting

1. Programming

Feedback algorithm

Hi I search an exemple of scheduling Feedback algorithm, or help about how to create one. Thanks (0 Replies)
Discussion started by: messier79
0 Replies

2. Shell Programming and Scripting

algorithm

PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP 21444 tomusr 213M 61M sleep 29 10 1:20:46 0.1% java/43 21249 root 93M 44M sleep 29 10 1:07:19 0.2% java/56 is there anyway i can use a command to get the total of the SIZE? 306M (Derive from... (5 Replies)
Discussion started by: filthymonk
5 Replies

3. UNIX for Advanced & Expert Users

Algorithm In Pseudocode

A) produce an algorithm in pseudocode and a flowchart that gets n from the user and calculate their sum. B) Write an algorithm in pseudocode and a flowchart that gets number x from he user and calculates x5 ( X to the power of %5). Calculate by using multiplication. ... (1 Reply)
Discussion started by: delsega
1 Replies

4. Programming

Please help me to develop algorithm

Hi guys , in my study book from which I re-learn C is task to generate all possible characters combination from numbers entered by the user. I know this algorithm must use combinatorics to calculate all permutations. Problem is how to implement algortihm. // This program reads the four numbers... (0 Replies)
Discussion started by: solaris_user
0 Replies

5. Homework & Coursework Questions

Heuristic Algorithm Example

Give a counter example such that the following heuristic algorithm, for the 2-tape problem, doesn't always produce the best solution: Algorithm: Sort {Xi} in descending order. Place files in tapes one at a time. For a file being considered, assign the file to the smaller tape. Thanks in... (1 Reply)
Discussion started by: sureshcisco
1 Replies

6. UNIX for Dummies Questions & Answers

banker's algorithm.. help

i'm doing banker's algorithm.. got some error there but i cant fix it.. please help!! #!/bin/bash echo "enter no.of resources: " read n1 echo -n "enter the max no .of resources for each type: " for(( i=0; i <$n1; i++ )) do read ${t} done echo -n "enter no .of... (1 Reply)
Discussion started by: syah
1 Replies

7. Homework & Coursework Questions

Banker's algorithm

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: shell scripts to simulate Banker’s algorithm on a collection of processes (process details are entered as inputs... (4 Replies)
Discussion started by: syah
4 Replies

8. Shell Programming and Scripting

Masking algorithm

I have a requirement of masking few specific fields in the UNIX file. The details are as following- File is fixed length file with each record of 250 charater length. 2 fields needs to be masked – the positions are 21:30 and 110:120 The character by character making needs to be done which... (5 Replies)
Discussion started by: n78298
5 Replies
restore(1M)															       restore(1M)

NAME
restore, rrestore - restore file system incrementally, local or across network SYNOPSIS
key [name ...] key [name ...] DESCRIPTION
The and commands read tapes previously dumped by the or command (see dump(1M) and rdump(1M)). Actions taken are controlled by the key argument where key is a string of characters containing not more than one function letter and pos- sibly one or more function modifiers. One or more name arguments, if present, are file or directory names specifying the files that are to be restored. Unless the modifier is specified (see below), the appearance of a directory name refers to the files and (recursively) subdi- rectories of that directory. Function Portion of key The function portion of the key is specified by one of the following letters: Read the tape and load into the current directory. should be used only after careful consideration, and only to restore a complete dump tape onto a clear file system, or to restore an incremental dump tape after a full level zero restore. Thus, is a typical sequence to restore a complete dump. Another or can then be performed to restore an incremental dump on top of this. Note that and leave a file in the root directory of the file system to pass information between incremental restore passes. This file should be removed when the last incremental tape has been restored. A or followed by a and a or is used to change the size of a file system (see newfs(1M)). and request a particular tape of a multivolume set on which to restart a full restore (see above). This provides a means for interrupting and restarting and Extract the named files from the tape. If the named file matches a directory whose contents had been written onto the tape, and the modifier is not specified, the directory is recursively extracted. The owner, modification time, and mode are restored (if possible). If no file argument is given, the root directory is extracted, which results in the entire contents of the tape being extracted, unless has been specified. Names of the specified files are listed if they occur on the tape. If no file argument is given, the root directory is listed, which results in the entire content of the tape being listed, unless has been specified. The next argument to is used as the dump file number to recover. This is useful if there is more than one dump file on a tape. This mode allows interactive restoration of files from a dump tape. After reading in the directory information from the tape, and provide a shell-like interface that allows the user to move around the directory tree selecting files to be extracted. The available commands are given below; for those commands that require an argument, the default is the current directory. The current directory or specified argument is added to the list of files to be extracted. If a directory is specified, it and all its descendents are added to the extraction list (unless the key is specified on the command line). File names on the extraction list are displayed with a leading when listed by Change the current working directory to the specified argument. The current directory or specified argument is deleted from the list of files to be extracted. If a directory is specified, it and all its descendents are deleted from the extraction list (unless is specified on the command line). The most expedient way to extract files from a directory is to add the directory to the extraction list, then delete unnecessary files. All files named on the extraction list are extracted from the dump tape. and ask which volume the user wants to mount. The fastest way to extract a few files is to start with the last volume, then work toward the first volume. List a summary of the available commands. List the current or specified directory. Entries that are directories are displayed with a trailing Entries marked for extraction are displayed with a leading If the verbose key is set, the inode number of each entry is also listed. Print the full path name of the current working directory. and immediately exit, even if the extraction list is not empty. Set the owner, modes, and times of all directories that are added to the extraction list. Nothing is extracted from the tape. This setting is useful for clean- ing up after a restore aborts prematurely. The sense of the modifier is toggled. When set, the verbose key causes the command to list the inode numbers of all entries. It also causes and to print out information about each file as it is extracted. Function Modifiers The following function modifier characters can be used in addition to the letter that selects the function desired: Specify the block size of the tape in kilobytes. If the option is not specified, and try to determine the tape block size dynamically. Specify the name of the archive instead of If the name of the file is reads from standard input. Thus, and can be used in a pipeline to dump and restore a file system with the command When using this key should be specified, and the next argument supplied should be of the form Extract the actual directory, rather than the files to which it refers. This prevents hierarchical restoration of complete subtrees from the tape, rather than the files to which it refers. Extract by inode numbers rather than by file name. This is useful if only a few files are being extracted and one wants to avoid regenerating the complete path name to the file. Type the name of each file and treat, preceded by its file type. Normally and do their work silently; the modifier specifies verbose output. Do not ask whether to abort the operation if and encounters a tape error. and attempt to skip over the bad tape block(s) and continue. creates a server, either or on the remote machine to access the tape device. DIAGNOSTICS
and complain about bad key characters. and complain if a read error is encountered. If the modifier has been specified, or the user responds and attempt to continue the restore. If the dump extends over more than one tape, and ask the user to change tapes. If the or function has been specified, and also ask which volume the user wants to mount. The fastest way to extract a few files is to start with the last volume and work towards the first volume. There are numerous consistency checks that can be listed by and Most checks are self-explanatory or can ``never happen''. Here are some common errors: The specified file name was listed in the tape directory but not found on the tape. This is caused by tape read errors while looking for the file, and from using a dump tape created on an active file system. A file not listed in the directory showed up. This can occur when using a dump tape created on an active file system. When doing an incremental restore, a tape that was written before the previous incremental tape, or that has too low an incremental level has been loaded. When doing an incremental restore, a tape that does not begin its coverage where the previous incremental tape left off, or that has too high an incremental level has been loaded. A tape read error has occurred. If a file name is specified, the contents of the restored files are probably partially wrong. If restore is skipping an inode or is trying to resynchronize the tape, no extracted files are corrupted, although files may not be found on the tape. After a tape read error, and may have to resynchronize themselves. This message indicates the number of blocks skipped over. WARNINGS
and can get confused when doing incremental restores from dump tapes that were made on active file systems. A level zero dump (see dump(1M)) must be done after a full restore. Since restore runs in user code, it has no control over inode alloca- tion; thus a full dump must be done to get a new set of directories reflecting the new inode numbering, even though the contents of the files are unchanged. AUTHOR
and were developed by the University of California, Berkeley. FILES
Default tape drive. File containing directories on the tape. Owner, mode, and time stamps for directories. Information passed between incremental restores. SEE ALSO
dump(1M), mkfs(1M), mount(1M), newfs(1M), rmt(1M), mt(7). restore(1M)
All times are GMT -4. The time now is 02:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy