...Hashing hash functions collision resolution applications References: Algorithms in Java, Chapter 14 http://www.cs.princeton.edu/introalgsds/42hash 1 Summary of symbol-table implementations implementation unordered array ordered array unordered list ordered list BST randomized BST red-black tree guarantee search N lg N N N N 7 lg N 3 lg N insert N N N N N 7 lg N 3 lg N delete N N N N N 7 lg N 3 lg N search N/2 lg N N/2 N/2 1.39 lg N 1.39 lg N lg N average case insert N/2 N/2 N N/2 1.39 lg N 1.39 lg N lg N delete N/2 N/2 N/2 N/2 ? 1.39 lg N lg N ordered iteration? no yes no yes yes yes yes Can we do better? 2 Optimize Judiciously More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason including blind stupidity. - William A. Wulf We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. - Donald E. Knuth We follow two rules in the matter of optimization: Rule 1: Don't do it. Rule 2 (for experts only). Don't do it yet - that is, not until you have a perfectly clear and unoptimized solution. - M. A. Jackson Reference: Effective Java by Joshua Bloch. 3 Hashing: basic plan Save items in a key-indexed table (index is a function of the key). Hash function. Method for computing table index from key. hash(“it”) = 3 ?? hash(“times”) = 3 0 1 2 3 4 5 “it” Issues. 1. Computing the hash function 2. Collision resolution:...
Words: 4332 - Pages: 18
...ACTG 351 Homework #3 (Investments) - Answers 1. Clear Monkey Technologies (CMT) purchased 10-year bonds issued from Banana Bandana’s Inc with a face value of $2,000,000 and a stated rate of 8 percent on January 1, 2013. Interest is payable semi-annually on December 31 and June 30. The market rate of interest for similar bonds is 10 percent. In addition, the market value of the bonds at June 30 and December 31 were $2,037,000 and $1,977,000, respectively. Assume the company prepares financial reports semiannually at June 30 and December 31. a) Assume CMT accounts for these bonds as (1) Held-to-Maturity Securities and (2) Available-for-Sale Securities. Please record the initial purchase of the bonds and the first two interest payments on June 30 and December 31, as well as any adjusting entries on June 30 and December 31 assuming these two classifications. HTM and AFS (PV = 2,000,000*.37689 + 80,000*12.46221): Jan 1 Investment in Bonds 2,000,000 Discount on Bonds Cash Jun 30 Cash 80,000 Discount on Bonds 7,538 Interest Revenue Dec 31 Cash 80,000 Discount on Bonds 7,915 Interest Revenue 249,243 1,750,757 87,538 87,915 Adjusting Entries for AFS: Adjustment = 2,037,000 – 1,758,295 = 278,705 Jun 30 Fair Value Adjustment 278,705 Net Unrealized Gains/Losses – OCI 278,705 Adjustment = (1,977,000 – 1,766,210) - 278,705 = -67,915 Dec 31 Net Unrealized Gains/Losses – OCI 67,915 Fair Value Adjustment 67,915 b) CMT sells the bonds...
Words: 3202 - Pages: 13
...Handbook of Management Accounting Research Volume 3 Edited by CHRISTOPHER S. CHAPMAN Imperial College London, UK ANTHONY G. HOPWOOD University of Oxford, UK MICHAEL D. SHIELDS Michigan State University, USA AMSTERDAM – BOSTON – HEIDELBERG – LONDON – NEW YORK – OXFORD PARIS – SAN DIEGO – SAN FRANCISCO – SINGAPORE – SYDNEY – TOKYO Elsevier The Boulevard, Langford Lane, Kidlington, Oxford OX5 1GB, UK First edition 2009 Copyright © 2009 Elsevier Ltd. All rights reserved No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise without the prior written permission of the publisher Permissions may be sought directly from Elsevier’s Science & Technology Rights Department in Oxford, UK: phone ( 44) (0) 1865 843830; fax ( 44) (0) 1865 853333; email: permissions@elsevier.com. Alternatively visit the Science and Technology Books website at www.elsevierdirect.com/rights for further information Notice No responsibility is assumed by the publisher for any injury and/or damage to persons or property as a matter of products liability, negligence or otherwise, or from any use or operation of any methods, products, instructions or ideas contained in the material herein. British Library Cataloguing in Publication Data A catalogue record for this book is available from the British Library Library of Congress Cataloging-in-Publication Data A catalog record for...
Words: 187223 - Pages: 749