Sponsored Content
Top Forums Programming Difficult in analyzing an algorithm Post 302605080 by sureshcisco on Tuesday 6th of March 2012 03:22:31 PM
Old 03-06-2012
Difficult in analyzing an algorithm

Hello,

I was reading Heuritics text and came across an algorithm below. Finding hard to analyze it can any one help me out below...

How to analyze if I take say no. of types are 5 and each type has say 20 coins.

thanks.


Code:
Let {c1, c2...cn=1} be a set of distinct coin types where ci is an integer.
Sort coin types in decreasing order.
    numOfCoin = 0;
    amountRemain = M;
    for (i=1; i<=n && amountRemain>0; ++i) {
        j = amountRemain/ci;
        numCoin += j;
        amountRemain -= j*ci;
    }
    output numCoin;

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Analyzing System Core Files?

can some tell me how to do this. I mean, i tried finding this out on my own but when I checked the man pages, i got a truckload of commands available pertaining to this task which in turn got me confused. so my question is, if there is a simple straight forward(not necessarily easy) way to... (2 Replies)
Discussion started by: TRUEST
2 Replies

2. Shell Programming and Scripting

A difficult script (for me)

Hi, I'm a beginners, this is one of my first script, it's easy, but I don't know how to write this script: The script receive in input 4 parameters: 1) user_name 2) r and/or w and/or x ( rwx, rw, x, ....) 3) u and/or g and/or o ( u, uo, ugo, ...) 4) the path name The script print a... (2 Replies)
Discussion started by: DNAx86
2 Replies

3. Shell Programming and Scripting

analyzing tcpdump output

hello, i have a lot of pcap files (tcpdump output) that i want to compare. every tcpdump output has two file, server and client. what i want to do is: 1. take timestamp, source address, destination address, and packet id from each file (server and client) 2. find the packets sent from... (0 Replies)
Discussion started by: slumpia
0 Replies

4. Shell Programming and Scripting

analyzing data from more than one file

Hello, I have two data (.txt) files which I need to do some operations on them simultaneously. for example: file1: word11 word12 word13 word21 word 22 word 23 word31 word32 word33 file2: word11 word12 word13 word21 word 22 word 23 word31 word32 word33 I need to see if each... (13 Replies)
Discussion started by: shira
13 Replies

5. AIX

Help required in analyzing errpt in aix 5.3

I have received errpt like this.Any help will be highly appreciated.Recently my application has been migrated to aix 5.3 and working fine in aix 5.2 with out crashes. LABEL: CORE_DUMP IDENTIFIER: C69F5C9B Date/Time: Thu Apr 23 09:41:29 EDT 2009 Sequence Number: 948... (3 Replies)
Discussion started by: kittu1979
3 Replies

6. Emergency UNIX and Linux Support

Analyzing Core Dump

We have a binary that generates coredump. So I ran the gdb command to analyze the issue. Pleae note the binary and code are in two different locations and we cannot build the whole binary using debugging symbols. Hence how and what details can I find from below backtarce: gdb binary corefile ... (5 Replies)
Discussion started by: uunniixx
5 Replies

7. UNIX and Linux Applications

Benchmarking and performance analyzing in OS

Is/Are there an/some application/applications , package/packages for benchmarking or system performance measuring which are there for almost all Linux releases and distributions? (2 Replies)
Discussion started by: nixhead
2 Replies

8. UNIX for Dummies Questions & Answers

analyzing list with street addresses

Hi List, Could someone please point me into the right direction with the following: I have a file containing a list of street addresses. I need to sort all the street addresses with the same number to a new file containing the street name and corresponding number. So: Strawinskylaan... (3 Replies)
Discussion started by: M474746
3 Replies

9. AIX

Analyzing CPU usage

Hi Admins, I need your help to analyze the cpu usage of our main server. I have shared below, CPU usages during busy hours and non busy hours. CPU usage is always full at busy hours. Users always complaints about slowness. This server is a lpar partition and configured as uncapped mode. ... (7 Replies)
Discussion started by: newaix
7 Replies

10. AIX

Help Analyzing AIX System Metrics

Hi Guys, I need some help analyzing the attached metrics. System context is 2 LPAR's in a P795 running WebSphere App Server across 4 nodes (2 on each LPAR). Over the weekend both LPAR's lost power and upon re-start the application server response times have degraded by 25-30% for no obvious... (1 Reply)
Discussion started by: mgburns
1 Replies
SYSTEMD-ANALYZE(1)						  systemd-analyze						SYSTEMD-ANALYZE(1)

NAME
systemd-analyze - Analyze system boot-up performance SYNOPSIS
systemd-analyze [OPTIONS...] [time] systemd-analyze [OPTIONS...] blame systemd-analyze [OPTIONS...] critical-chain [UNIT...] systemd-analyze [OPTIONS...] plot [> file.svg] systemd-analyze [OPTIONS...] dot [PATTERN...] [> file.dot] systemd-analyze [OPTIONS...] dump systemd-analyze [OPTIONS...] set-log-level [LEVEL] DESCRIPTION
systemd-analyze may be used to determine system boot-up performance statistics and retrieve other state and tracing information from the system and service manager. systemd-analyze time prints the time spent in the kernel before userspace has been reached, the time spent in the initial RAM disk (initrd) before normal system userspace has been reached, and the time normal system userspace took to initialize. Note that these measurements simply measure the time passed up to the point where all system services have been spawned, but not necessarily until they fully finished initialization or the disk is idle. systemd-analyze blame prints a list of all running units, ordered by the time they took to initialize. This information may be used to optimize boot-up times. Note that the output might be misleading as the initialization of one service might be slow simply because it waits for the initialization of another service to complete. systemd-analyze critical-chain [UNIT...] prints a tree of the time-critical chain of units (for each of the specified UNITs or for the default target otherwise). The time after the unit is active or started is printed after the "@" character. The time the unit takes to start is printed after the "+" character. Note that the output might be misleading as the initialization of one service might depend on socket activation and because of the parallel execution of units. systemd-analyze plot prints an SVG graphic detailing which system services have been started at what time, highlighting the time they spent on initialization. systemd-analyze dot generates textual dependency graph description in dot format for further processing with the GraphViz dot(1) tool. Use a command line like systemd-analyze dot | dot -Tsvg > systemd.svg to generate a graphical dependency tree. Unless --order or --require is passed, the generated graph will show both ordering and requirement dependencies. Optional pattern globbing style specifications (e.g. *.target) may be given at the end. A unit dependency is included in the graph if any of these patterns match either the origin or destination node. systemd-analyze dump outputs a (usually very long) human-readable serialization of the complete server state. Its format is subject to change without notice and should not be parsed by applications. systemd-analyze set-log-level LEVEL changes the current log level of the systemd daemon to LEVEL (accepts the same values as --log-level= described in systemd(1)). If no command is passed, systemd-analyze time is implied. OPTIONS
The following options are understood: -h, --help Prints a short help text and exits. --user Shows performance data of user sessions instead of the system manager. --order, --require When used in conjunction with the dot command (see above), selects which dependencies are shown in the dependency graph. If --order is passed, only dependencies of type After= or Before= are shown. If --require is passed, only dependencies of type Requires=, RequiresOverridable=, Requisite=, RequisiteOverridable=, Wants= and Conflicts= are shown. If neither is passed, this shows dependencies of all these types. --from-pattern=, --to-pattern= When used in conjunction with the dot command (see above), this selects which relationships are shown in the dependency graph. They both require glob(7) patterns as arguments, which are matched against left-hand and right-hand, respectively, nodes of a relationship. Each of these can be used more than once, which means a unit name must match one of the given values. --fuzz=timespan When used in conjunction with the critical-chain command (see above), also show units, which finished timespan earlier, than the latest unit in the same level. The unit of timespan is seconds unless specified with a different unit, e.g. "50ms". --no-pager Do not pipe output into a pager. EXIT STATUS
On success, 0 is returned, a non-zero failure code otherwise. EXAMPLES
This plots all dependencies of any unit whose name starts with "avahi-daemon.": $ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg > avahi.svg $ eog avahi.svg This plots the dependencies between all known target units: systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' | dot -Tsvg > targets.svg $ eog targets.svg ENVIRONMENT
$SYSTEMD_PAGER Pager to use when --no-pager is not given; overrides $PAGER. Setting this to an empty string or the value "cat" is equivalent to passing --no-pager. SEE ALSO
systemd(1), systemctl(1) systemd 208 SYSTEMD-ANALYZE(1)
All times are GMT -4. The time now is 02:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy